我正在使用测试一个Python应用程序,它有一个Selenium驱动程序。
我的测试结果显示了XPath表达式的一些不稳定性问题。有时,我会得到一个“无效的XPath”错误,其中包含一个有效的XPath表达式。如果我再做一次测试,可能会成功的。我跟踪了堆栈跟踪,但找不到解决方案。
堆栈跟踪:
I do not see "top-search-tag-name" element - FAILED - Error executing action <bound method ElementIsNotVisibleAction.execute of <pyccuracy.
我试图在我的linux服务器上运行一个检查价格的机器人,我在我的python脚本中使用了selenium。我在后台用nohup运行它,但过了一段时间后,我遇到了以下错误:
File "selenium_amazon.py", line 68, in <module>
isProduct()
File "selenium_amazon.py", line 63, in isProduct()
File "selenium_amazon.py", line 22, in Product_functie
EC.pre
我知道它能做什么,但我不明白它是怎么做的,如果你知道我的意思。例如,下面的代码将从页面中取出所有链接,如果它在页面上找不到任何<a>标记,它就会超时。
driver.get('https://selenium-python.readthedocs.io/waits.html')
links = WebDriverWait(driver, 30).until(EC.presence_of_all_elements_located((By.TAG_NAME, 'a')))
for link in links:
print(link.get_a
我试图使用table从div元素中选择selenium值,
当我检查元素时,我可以看到元素包含table,但是在查看源代码时找不到它(这是在尝试通过selenium访问时发生的)。
检查期间的:
下面是我试过的代码,
totals = driver.find_element_by_id("totals")#gets the totals div element. Only one is there
labels=totals.find_elements_by_class_name("hasLabel")#should get the table row
我在eBay网站上使用Selenium WebDriver。我正在尝试将下拉菜单从最佳匹配更改为最低价格+ P&P。这是我的代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
sortdown = browser.find_element(By.XPATH, '//*[@id=
我有一个这样的测试用例:
scenario "there should be an SVG tag" do
...
page.find("svg")
end
由于某些原因,Capybara找不到svg标记,尽管当我查看页面的源代码时,该标记就在那里(而且是在视觉上)。
我只能在执行如下操作后才能让它找到SVG标记:
scenario "there should be an SVG tag" do
...
page.find("#layers *[xmlns='http://www.w3.
selenium: 3.141.0,语言:Python3。
在访问下面的显式等待方法时,我得到了以下错误。
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
我正在使用python的selenium绑定来下载包含字符串"VS“的页面上的所有链接。问题是列表中的第二项不是有效的网页(返回404错误),如果我手动单击断开的链接,它也会返回:
error.html - 404 error page does not exist.
如果我运行下面的代码,它会引发一个错误。
import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import StaleE
找不到某些元素存在,我想要放入if语句:(编辑)
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
from selenium
我正在尝试自动更新web应用程序中的字段。因此,在登录后url不会更改。
这是到目前为止我的代码
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
path_t