问题遇到的现象和发生背景
最近在学自动化,但是点击登录这个按钮运行不了
用代码块功能插入代码,请勿粘贴截图
//python代码
driver.implicitly_wait(20)
Denglu= driver.find_element(By.XPATH, "//button[@id=‘signin-submit-button’]")
# print(Sale)
Denglu.click()
//页面代码
<button id="signin-submit-button" type="submit" class="rs-aos-sign-in-submit-btn form-button" data-analytics-title="signin-submit-button" data-autom="signin-submit-button"><span><span aria-hidden="true">登录</span><span class="visuallyhidden">登录</span></span></button>
运行结果及报错内容
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //button[@id=‘signin-submit-button’] because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//button[@id=‘signin-submit-button’]' is not a valid XPath expression.
(Session info: chrome=105.0.5195.127)
我的解答思路和尝试过的方法
使用了id、xpath等多个定位元素的方法,解释器始终定位不到
我想要达到的结果
能正常点击