简体   繁体   English

如何更改选择器以使网站显示登录而不是使用 selenium python 和 chromedriver 进行注册?

[英]How do I change the selector so that the website shows login instead of signup using selenium python and chromedriver?

enter image description here REGISTER LOGIN The code i wrote in python在此处输入图像描述注册登录 我在 python 中编写的代码

driver.find_element_by_xpath("//div[@id='sectionContainer']//div[@id='login_section_btn']")
#driver.execute_script("arguments[0].setAttribute('class','active_section_btn')", element)

Error message that i am getting is:我收到的错误消息是:

Unable to locate element: {"method":"xpath","selector":"//div[@id='sectionContainer']//div[@id='login_section_btn']"} (无法定位元素:{"method":"xpath","selector":"//div[@id='sectionContainer']//div[@id='login_section_btn']"} (

driver = webdriver.Chrome()
driver.get("https://secura.e-sim.org/")
WebDriverWait(driver, 10).until(
    EC.presence_of_element_located(
        (By.XPATH, "// div[@id='sectionContainer']//div[@id='login_section_btn']"))
).click()

you should use explicit wait for waiting till the element is loaded properly.您应该使用显式等待等待元素正确加载。 THe second error element not interactable may be bacause the button is disabled or something unless we have access to website or have screen shot its hard to tell.第二个不可交互的错误元素可能是因为按钮被禁用或其他原因,除非我们可以访问网站或屏幕截图很难分辨。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM