无法使用 Selenium 单击登录按钮
Can't click the login button with Selenium
我尝试过使用 .click()
、.submit()
和 driver.get()
,但似乎没有任何效果。该站点是 gosgc.com
<!-- -->
<div_ngcontent-c1=""class="user user--login">
<a_ngcontent-c1=""class="recover-username"href="/recover- user"routerlink="/recover-user" routerlinkactive="menu__item--
active">Forgot Username?</a>
<a_ngcontent-c1=""class="button">Login</a>
</div>
感谢您的帮助!
请尝试以下操作之一:
# catching the element (login button) using xpath
driver.find_element_by_xpath("/html/body/sgc-web/div/general- layout/div/div/div[3]/a[2]").click()
# catching the element (login button) using CSS Selector
driver.find_element_by_css_selector("body > sgc-web > div > general-layout > div > div > div.user.user--login > a.button").click()
# catching the element (login button) using class name
driver.find_element_by_class_name("button").click()
# catching the element (login button) using link text
driver.find_element_by_link_text("Login").click()
我尝试过使用 .click()
、.submit()
和 driver.get()
,但似乎没有任何效果。该站点是 gosgc.com
<!-- -->
<div_ngcontent-c1=""class="user user--login">
<a_ngcontent-c1=""class="recover-username"href="/recover- user"routerlink="/recover-user" routerlinkactive="menu__item--
active">Forgot Username?</a>
<a_ngcontent-c1=""class="button">Login</a>
</div>
感谢您的帮助!
请尝试以下操作之一:
# catching the element (login button) using xpath
driver.find_element_by_xpath("/html/body/sgc-web/div/general- layout/div/div/div[3]/a[2]").click()
# catching the element (login button) using CSS Selector
driver.find_element_by_css_selector("body > sgc-web > div > general-layout > div > div > div.user.user--login > a.button").click()
# catching the element (login button) using class name
driver.find_element_by_class_name("button").click()
# catching the element (login button) using link text
driver.find_element_by_link_text("Login").click()