简体   繁体   English

硒:selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法定位元素:

[英]Selenium: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element:

My Code:我的代码:

driver.find_element_by_xpath("//div[@class='x-grid3-cell-inner x-grid3-col-1']//a").click() # Click on Device eid

time.sleep(15)
driver.find_element_by_xpath("//table[@id='ping']//button[contains(text(),'Ping')]").click() # click on Ping

Getting error:获取错误:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: 

On Chrome and firefox xpath is correct, still getting the error?在 Chrome 和 firefox 上 xpath 是正确的,仍然出现错误? Can anyone help here, I know its a silly任何人都可以在这里提供帮助,我知道这很愚蠢

在此处输入图片说明one.一。

Check whether element is under iFrame tag, If yes then first need to switch into frame and then perform intended action.检查元素是否在iFrame标签下,如果是则首先需要切换到框架然后执行预期的操作。

iframe = driver.find_element_by_name('frame_name')

driver.switch_to.frame(iframe)

If its timing related issue then introduce Implicit and explicit wait in your code.如果它的时间相关问题,则在您的代码中引入隐式和显式等待。

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//div[@class='x-grid3-cell-inner x-grid3-col-1']//a"))
element.click()

Hope this will help希望这会有所帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法定位元素 - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法定位元素: - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法找到元素: - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:尝试使用硒单击“下一步”按钮时无法定位元素 - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element while trying to click Next button with selenium selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法通过 Python 使用 Selenium 定位元素错误 - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element error using Selenium through Python Python Selenium 检查复选框:selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法定位元素 - Python Selenium checking checkbox: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element Python Selenium Webdriver selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法定位元素 - Python Selenium Webdriver selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法使用带有Python的Selenium ChromeDriver Chrome找到元素 - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element using Selenium ChromeDriver Chrome with Python selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法使用Selenium和Python定位元素 - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element using Selenium and Python 使用 selenium 在文本字段中设置值。 selenium.common.exceptions.NoSuchElementException:消息:无法定位元素: - Setting a value in a text field using selenium. selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM