我已经使用Selenium好几个月,我们用它来自动化我们的一些内部测试过程.脚本一直很好.我最近使用FF 27.01升级到C#2.40.0 webdriver,我们的脚本现在在随机位置失败,出现以下错误.
[Portal.SmokeTest.SmokeRunTest.Booking] TearDown method failed. OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/element timed out after 60 seconds.
----> System.Net.WebException : The operation has timed out
TearDown : OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/window timed out after 60 seconds.
----> System.Net.WebException : The operation has timed out
[09:01:20]
[Portal.SmokeTest.SmokeRunTest.Booking] TearDown method failed. OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/element timed …Run Code Online (Sandbox Code Playgroud) 目前我正在尝试使用Selenium WebDriver捕获屏幕截图.但我只能获得整页屏幕截图.但是,我想要的只是捕获页面的一部分,或者只是基于ID或任何特定元素定位器捕获特定元素.(例如,我希望用图像id ="Butterfly"捕获图片)
有没有办法按选定的项目或元素捕获屏幕截图?
我正在使用Selenium WebDriver 2.25.0进行多语言Web应用程序,主要测试页面内容(适用于阿拉伯语,英语,俄语等不同语言).
对于我的应用程序,根据性能更好,并确保它应该支持所有的浏览器(即IE 7,8,9,FF,Chrome等).
提前感谢您的宝贵建议.
我现在正在看Selenium Server,我似乎没有注意到支持无头浏览器测试的驱动程序.
除非我弄错了,否则它不支持它.如果你在X上,你可以创建一个虚拟帧缓冲来隐藏浏览器窗口,但这不是一个真正的无头浏览器.
任何人都可以开导我吗?Selenium是否支持无头浏览器测试?
selenium automated-tests unit-testing headless-browser selenium-webdriver
我正在使用Java实现许多Selenium测试.有时,我的测试由于a而失败StaleElementReferenceException.你能建议一些让测试更稳定的方法吗?
有人知道Selenium(最好是WebDriver)是否能够在启动Selenium客户端之前与已经运行的浏览器进行通信并采取行动?
我的意思是,如果Selenium能够在不使用Selenium Server的情况下与浏览器通信(例如可以手动启动Internet Explorer).
我是python selenium的新手,我试图点击一个具有以下html结构的按钮:
<div class="b_div">
<div class="button c_button s_button" onclick="submitForm('mTF')">
<input class="very_small" type="button"></input>
<div class="s_image"></div>
<span>
Search
</span>
</div>
<div class="button c_button s_button" onclick="submitForm('rMTF')" style="margin-bottom: 30px;">
<input class="v_small" type="button"></input>
<span>
Reset
</span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我希望能够点击上面的Search和Reset按钮(显然是单独的).
我尝试了几件事,例如:
driver.find_element_by_css_selector('.button .c_button .s_button').click()
Run Code Online (Sandbox Code Playgroud)
要么,
driver.find_element_by_name('s_image').click()
Run Code Online (Sandbox Code Playgroud)
要么,
driver.find_element_by_class_name('s_image').click()
Run Code Online (Sandbox Code Playgroud)
但是,我似乎总是最终得到NoSuchElementException,例如:
selenium.common.exceptions.NoSuchElementException: Message: u'Unable to locate element: {"method":"name","selector":"s_image"}' ;
Run Code Online (Sandbox Code Playgroud)
我想知道我是否能以某种方式使用HTML的onclick属性来进行selenium点击?
任何可以指向正确方向的想法都会很棒.谢谢.
在WebDriver中,如果我使用sendKeys,它会将我的字符串附加到字段中已存在的值.我无法通过使用clear()方法清除它,因为第二个我这样做,网页将抛出一个错误,说它必须介于10和100之间.所以我无法清除它或者之前会抛出错误我可以使用sendKeys输入新值,如果我sendKeys它只是将它附加到已存在的值.
WebDriver中有什么东西可以覆盖字段中的值吗?
在Selenium with Python中,是否可以将WebElement的所有子节点作为列表?
Sendkeys无法正常工作.请帮我解决这个问题..
WebElement username = driver.findElement(By.xpath("//*[@id='username']"));
username.sendKeys("123456");
Run Code Online (Sandbox Code Playgroud)
安慰:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.31)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86)
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'NEW-PC', ip: '192.168.0.103', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_161'
Run Code Online (Sandbox Code Playgroud)
司机信息:
org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: …Run Code Online (Sandbox Code Playgroud) java selenium google-chrome selenium-chromedriver selenium-webdriver