【问题标题】:python selenium get asp-classic elementpython selenium 获取 asp-classic 元素
【发布时间】:2016-05-11 10:54:51
【问题描述】:

我尝试找到这个 URL 页面做一些 selenium 自动化测试,通常可以获取 web 元素,但有些页面很奇怪......即使使用 XPATH 也找不到 web 元素(使用 chrome 浏览器可以看到元素,但可以不对这个元素做一些动作..事实上......错误信息是“找不到元素)

貌似是asp.classic生成页面....windows.onload()页面

driver_path = os.path.join(os.getcwd(), "IEDriverServer.exe")
driver = webdriver.Ie(driver_path)
driver.get(mytestpage)

element = WebDriverWait(driver, 300).until(
        EC.element_to_be_clickable((By.LINK_TEXT, "Hardware")))
element.click()

element = WebDriverWait(driver, 300).until(
        EC.element_to_be_clickable((By.XPATH, "'//*[@id="testpage"]/table/tbody/tr/td[2]/table/tbody/tr[1]/td[2]/font/a[1]'")))
element.click()

【问题讨论】:

    标签: python selenium-webdriver asp-classic automated-tests


    【解决方案1】:

    您是否尝试过使用 selenium 显式等待?这可能是因为当您在该页面上执行 selenium 操作时,该页面正在完全加载。另外,检查加载页面的响应时间。

    【讨论】:

      猜你喜欢
      • 2022-01-03
      • 1970-01-01
      • 2020-05-30
      • 2021-04-05
      • 1970-01-01
      • 2017-08-22
      • 1970-01-01
      • 2022-01-05
      • 2016-05-23
      相关资源
      最近更新 更多