I am want to be able to click this element in the Yandex account sign up page.
I am using Selenium Chromedriver with python.
https://passport.yandex.com/registration/
I have tried this code
element = self.driver.find_element_by_class_name("toggle-link.link_has-no-phone").click()
webdriver.ActionChains(self.driver).move_to_element(element).click(element).perform()
but I get ElementClickInterceptedException.
There's a element.click().perform()
and you can also send a Return
key to the element
from selenium.webdriver.common.keys import Keys
element = ... # get your element
element.send_keys(Keys.RETURN) # or send a left mouse click
It looks like the way you're finding the element is wrong, there are two classes for that element and you have tried to specify both -> find_element_by_class_name only takes one class attribute value.
So, this should work for you
driver.find_element_by_class_name('link_has-no-phone').click()
Not sure why you are using ActionChains
here while you can simply click on the mentioned link.
Simplified code
self.driver.find_element_by_class_name("toggle-link.link_has-no-phone").click()
OR
element = self.driver.find_element_by_class_name("toggle-link.link_has-no-phone")
element.click()
OR
driver.find_element_by_css_selector('.toggle-link.link_has-no-phone').click()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.