天道酬勤,学无止境

webdriver

How do I select all the columns first cells (tds) in Selenium webdriver?

I'm using Selenium 2.12. Using the WebDriver API, let's say I have a WebElement that represents a table (<table>). Using that element, how do I select all the td's in the first column? I'm assuming an xpath expression is in order here. To better understand the table structure, if I get the HTML from my tableElement WebElement ... String html = (String)((JavascriptExecutor)driver).executeScript("return arguments[0].innerHTML;", tableElt); I get the jumble below. The key thing to notice is that there are 6 tr's and 16 td's ... <thead><tr><th colspan="1" class="GCSPOWVGE GCSPOWVEE GCSPOWVEF

2021-06-15 17:32:51    分类:问答    xpath   selenium   webdriver

Getting java.lang.IllegalStateException even after adding set property webdriver

I am getting Exception: in thread "main" java.lang.IllegalStateException:The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:199) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109) at org.openqa.selenium.chrome.ChromeDriverService.access$0(ChromeDriverService.java:1)

2021-06-15 15:17:10    分类:问答    java   selenium   selenium-webdriver   webdriver   selenium-chromedriver

Selenium Webdriver sendkeys does not trigger onchange event in IE9.0

I'm writing Selenium test scripts using Java for an application built in ExtJs. I have an input field in one of the page which is attached to 'onchange' event. Whenever user modifies the text in the field, onchange event is triggered. I'm using WebDriver sendKeys() to modify the text in the field. So whenever text is modified, 'onchange' event is triggered in Firefox and Chrome (as expected) but its not getting triggered in IE9.0. I have searched all over the net for the solution, but didn't find one. So please can someone help me on this? Let me know more info is required

2021-06-15 13:47:29    分类:问答    internet-explorer   selenium   webdriver

Selenium WebDriver - Unexpected modal dialog Alert

I am trying to use WebDriver to automate an website. I am using Firefox Driver, but the homepage has a Pop-up modal alert window: saying: You need to use IE 6.0 for viewing this application. Else some features may not work I checked the Source of the page, it has a function. The Modal Alert is not an HTML element, I tried finding any element with FireBug, but to no avail. if ( strBrowName == "Microsoft Internet Explorer" ) { if ( (( strBrowVersion.indexOf( 'MSIE 6' ) ) > 0 ) ) { } else { alert( "You need to use IE 6.0 for viewing this application. Else some features may not work" ); } In my

2021-06-15 06:33:43    分类:问答    java   selenium   selenium-webdriver   webdriver

WebDriver Actions.Perform() or Actions.Build().Perform()

I use Selenium2 WebDriver with C# Actions.Build - returns a composite IAction which can be used to perform the actions. (IActions has a Perform method to execute the actions) Actions.Perform - Performs the currently built action. In most of the examles use Actions like this: new Actions(IWebDriverObj).actions...Build().Perform() but this works as well new Actions(IWebDriverObj).actions...Perform() //no Build before Perform Is it necessary to use the Build() before the Perform() or Build() is for some compatibility purpose only? Thanks in advance for the answers

2021-06-15 04:22:35    分类:问答    c#   selenium   selenium-webdriver   webdriver

Using SelectByText (partial) with C# Selenium WebDriver bindings doesn't seem to work

I am using the Selenium WebDriver Extensions in C# to select a value from a select list by a partial text value (the actual has a space in front). I can't get it to work using a partial text match. Am I doing something wrong or is this a bug? Reproducible example: using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace AutomatedTests { [TestClass] public class UnitTest1 { [TestMethod] public void TestMethod1() { var driver = new FirefoxDriver(); driver.Navigate().GoToUrl("http://code.google.com/p

2021-06-15 01:09:17    分类:问答    c#   .net   selenium   webdriver   selenium-webdriver

Tell me why this does not end up with a timeout error (selenium 2 webdriver)?

from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait browser = webdriver.Firefox() browser.get("http://testsite.com") element = WebDriverWait(browser, 10).until(lambda browser : browser.find_element_by_id("element")) element.click() # it actually goes to page http://testsite.com/test-page.html print "Just clicked! And I'm expecting timeout error!" new_element = WebDriverWait(browser, 0.1).until(lambda browser : browser.find_element_by_id("element")) print "Too bad there's no timeout error, why?!" OK, as you can see even I set wait time to 0.1 sec there's still

2021-06-14 20:42:13    分类:问答    python   selenium   webdriver   selenium-webdriver

WebDriver: add new element

Is there a method to add/insert an element in the current DOM?

2021-06-14 06:06:35    分类:问答    webdriver

Chrome: fake microphone input for test purpose

For testing purpose with protractor, I need to simulate audio input from the microphone on a computer without microphone. With the "--use-fake-device-for-media-stream" flag, Chrome can simulate a fake microphone. However, no input is coming from the fake microphone so my tests fails. Is it possible to simulate sound getting out of the microphone ? Thanks !

2021-06-14 02:18:09    分类:问答    selenium   selenium-webdriver   webdriver   protractor

“Error while loading shared libraries: libnss3.so” while running Gtlab CI job to perform automated testing using webdriverio

I'm setting up the CI job for automated testing in selenium inside Gitlab CI, but the test is failing due to the issue. 019-09-27T11:03:17.404Z INFO @wdio/cli:Launcher: Run onPrepare hook /builds/shauryav/test-react-ci-cd/node_modules/chromedriver/lib/chromedriver/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory I have tried numbers of solutions like installing package "@wdio/cli": "^5.13.2", "webdriverio": "^5.13.2" but nothing works. For the note, I'm not using any docker setup /builds/shauryav/test-react-ci-cd/node

2021-06-14 02:12:36    分类:问答    linux   selenium   webdriver   selenium-chromedriver   gitlab-ci