我希望自动执行此页面上的一些点击,我将其用作测试,因为我刚刚学习 Selenium。
https://www.pgatour.com/competition/2019/safeway-open/leaderboard.html
当我加载页面时,我无法让我的代码自动接受并关闭 cookie 覆盖层,这阻止了我进一步的操作。
我尝试了各种方法来识别该元素,但每次都收到相同的消息。
我相信这是我需要识别的元素的 HTML:
<a class="call" tabindex="0" role="button">Agree and Proceed</a>
Run Code Online (Sandbox Code Playgroud)
我的代码的最新版本是这样的:
<a class="call" tabindex="0" role="button">Agree and Proceed</a>
Run Code Online (Sandbox Code Playgroud)
错误信息是:
Run Code Online (Sandbox Code Playgroud)selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//a[@class = 'call']"}