我试图自动化salesforce,但是我在定位器中遇到了一些麻烦。我正在使用Python和硒webdriver来做到这一点。如何在表列行中找到元素
我试图点击该元素(代码片段给出):
< th scope = "row"
class = " dataCell cellCol1 " > < a href = "javascript:srcUp(%27%2F0019E00000SLiUQ%3FsrPos%3D0%26srKp%3D001%26isdtp%3Dvw%27);"
data - seclke = "Account"
data - seclkh = "73556054e04c9691f20b5b34809356fd"
data - seclki = "0019E00000SLiUQ"
data - seclkp = "/0019E00000SLiUQ"
data - seclkr = "1"
onmousedown = "searchResultClick.mousedown(this, event)" > Harris Kemp < /a></th >
然而,由于某种原因,无法找到它。
我尝试了不同的解决方案,我在网上找到,他们都没有似乎工作。
这里是我的代码:
driver.switch_to.frame(1)
# driver.switch_to.frame(driver.find_element_by_id("history-iframe"))
# mouseDown() // i entered the location of the element here
# pyautogui.click() // i entered the location of the element here
这里是另一种方式,我想:
elem = driver.find_element_by_xpath("//a[@data-seclkr='1']")
driver.execute_script("arguments[0].click();", elem)
我用各种不同的XPath可用,它仍然不会一下就可以了。
如果有人能帮忙,请大家帮忙。
I have attached the full html body image here
请确保您简要说明您在开始时想要做什么。该片段可以在之后粘贴。有人可能会因此而降低你的问题。为了您的答案,我正在尝试寻找类似的东西,并且在我到家时我会回答:) –
非常感谢Apolo Radomer的领导:) – zplush