[英]How to click on this element in Python Selenium?
I'm trying to click this element with Python Selenium.我正在尝试使用 Python Selenium 单击此元素。 The element seems to be located within a table if that is relevant.如果相关,该元素似乎位于表格中。 I've also already tried waiting until the element is present as well, but no luck.我也已经尝试过等到元素也存在,但没有运气。 Here is the code I've written so far:这是我到目前为止编写的代码:
chrome_browser.find_element_by_xpath(f"//a[contains(text(),'90099029279')]").click()
Here is the HTML:这是 HTML:
<a href="/lightning/r/a5f3o000001A2Z2AAK/view" data-id="a5f3o000001A2Z2AAK" tabindex="-1">3418-3420 19th Street, San Francisco, CA 94110- 90099029279</a>
Any help is appreciated, thank you so much!任何帮助表示赞赏,非常感谢!
btn = chrome_browser.find_element_by_css_selector('css selector')
btn.click()
driver.find_element_by_link_text('3418-3420 19th Street, San Francisco, CA 94110- 90099029279').click()
driver.find_element_by_partial_link_text('90099029279').click()
You can use pyautogui module, though you need to install it first:您可以使用 pyautogui 模块,但您需要先安装它:
pyautogui.moveTo(100, 150) # Move the mouse to XY coordinates.
pyautogui.click()
It presses the mouse at whatever spot you want it to press (in your case, the button).它在您希望它按下的任何位置(在您的情况下为按钮)按下鼠标。 I hope this is helpful:)我希望这是有帮助的:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.