Tagged Questions
68
votes
16answers
101k views
42
votes
7answers
67k views
How to select/get drop down option in Selenium 2
I am converting my selenium 1 code to selenium 2 and can't find any easy way to select a label in a drop down menu or get the selected value of a drop down. Do you know how to do that in Selenium 2?
...
28
votes
6answers
20k views
Selenium WebDriver : Wait for complex page with JavaScript(JS) to load
I have a web application to test with selenium. There is a lot of JavaScript running on page load.
This JavaScript code is not so well written but I can't change anything.
So waiting for an element to ...
27
votes
3answers
11k views
WebDriver: get HTTP Response Code
I write Tests with Selenium2/WebDriver and want to test if HTTP Request returns an HTTP 403 Forbidden.
Is it possible to get the http response status code with web driver?
25
votes
1answer
1k views
Using a Java library with Scala reserved words
I'm using an external library written in Java (Selenium). One of the function calls has the signature type(String, String), and I keep getting compiler errors when trying to call it from Scala, that ...
23
votes
14answers
37k views
Selenium click() event seems not to be always triggered => results in timeout?
Here's what I do:
selenium.click("link=mylink");
selenium.waitForPageToLoad(60000);
// do something, then navigate to a different page
// (window focus is never changed in-between)
...
22
votes
6answers
42k views
How to check if an element is visible with WebDriver
With WebDriver from Selenium 2.0a2 I am having trouble checking if an element is visible.
WebDriver.findElement returns a WebElement, which unfortunately doesn't offer an isVisible method. I can go ...
21
votes
11answers
8k views
Selenium is to Web UI testing as ________ is to Windows application UI testing [closed]
I'm interested in UI testing a client only Java application. What is the most popular framework for doing so? What is your recommended framework? Also, why doesn't Selenium do this (or does it)? It ...
19
votes
6answers
36k views
Selenium checkbox attribute “checked”
I am using Selenium in Java to test the checking of a checkbox in a webapp. Here's the code:
private boolean isChecked;
private WebElement e;
I declare e and assign it to the area where the ...
19
votes
8answers
20k views
selenium WebDriver StaleElementReferenceException
i get this error when running my tests:
org.openqa.selenium.StaleElementReferenceException: Element is no longer attached to the DOM
any idea on how to solve the above exception?
this happen in my ...
18
votes
6answers
14k views
Using Selenium to retrieve value of a HTML input
In the HTML of a webapp there is the following code
<input type="text" name="prettyTime" id="prettyTime" class="ui-state-disabled prettyTime" readonly="readonly">
What is actually shown on ...
15
votes
6answers
23k views
How to deal with file uploading in test automation using selenium or webdriver
I think that everybody how uses Webdriver for test automation must be aware of its great advantages for web development.
But there is a huge issue if file uploading is part of your webflow. It stops ...
15
votes
4answers
6k views
Selenium hangs instantiating FirefoxDriver
I try to get started with selenium (downloaded the current version today) and copied their example which opens a browser and performs a google search.
However, the program hangs forever in the 1st ...
15
votes
4answers
33k views
How to perform mouseover function in Selenium WebDriver using Java?
I want to do mouseover function over a drop down menu. When we hover over the menu, it will show the new options.
I tried to click the new options using the xpath. But cannot click the menus directly.
...
14
votes
3answers
16k views
How to check if an alert exists using WebDriver?
I need to check the existence of Alert in WebDriver with Java.
Sometimes it pops up an alert but sometimes it will not pop up. I need to check if the alert exists first, then I can accept or dismiss ...
14
votes
4answers
7k views
Selenium WebDriver: clicking on elements within an SVG using XPath
I have an SVG object with a few circle and rectangle elements. Using webdriver, I can click on the main svg object, but not any of the elements within it. The problem only seems to be with clicking ...
13
votes
5answers
12k views
Page Object Model Best Practices in Selenium
When you are modelling your page objects, how would you deal with a page which has form and about 50 input fields on it? What is the best practice here?
Would you create a page object and write a ...
13
votes
6answers
2k views
Selenium - Wait for network traffic
We're using Selenium with the Java API and some Javascript user extensions. We use a lot of AJAX calls in our app. A lot of our tests fail randomly because sometimes the AJAX calls finish slower than ...
12
votes
4answers
17k views
How to automate drag & drop functionality using selenium web driver
How to automate drag & drop functionality using selenium webdriver in java
12
votes
7answers
8k views
Selenium run as a Windows service to take screenshots on errors
I would like an automated web tests suite based on Selenium RC to take screenshots of pages when some errors are encountered. The test suite is a part of the continuous integration process and ...
11
votes
1answer
21k views
Getting the URL of the current page using Selenium WebDriver
I'm attempting to get the URL of the currently open page. I am using Selenium WebDriver and Java.
I am accessing the current URL via:
WebDriver driver = new WebDriver();
String url = ...
11
votes
2answers
300 views
Node.js Selenium IPv6 Issue (SocketException Protocol family unavailable)
This error only happens when I spawn the ios-driver jar as a Node.js child.
The error is java.net.SocketException: Protocol family unavailable
selenium-test.js:
var spawn = ...
11
votes
3answers
2k views
Testing onbeforeunload events from Selenium
I'm trying to write a Selenium test for a web page that uses an onbeforeunload event to prompt the user before leaving. Selenium doesn't seem to recognize the confirmation dialog that comes up, or to ...
10
votes
6answers
35k views
Using Chrome Driver with Selenium 2
I'm trying to use Chrome Drive to execute some of my tests, which are working perfectly with Firefox, but I'm not being able to execute them, I'm already verified the requirements, which are the ...
10
votes
4answers
22k views
Equivalent of waitForVisible/waitForElementPresent in Selenium WebDriver tests using Java?
With "HTML" Selenium tests (created with Selenium IDE or manually), you can use some very handy commands like WaitForElementPresent or WaitForVisible.
<tr>
...
10
votes
13answers
11k views
Can selenium handle autocomplete?
I have a test case that requires typing in a partial value into an ajax based textfield and verifying the list has the expected content. If it does, select the content. Any idea how to make this ...
10
votes
9answers
5k views
Running a single test in maven -> No tests were executed!
When I run a single test in Maven with this command:
mvn test -Dtest=InitiateTest
I'm getting the following result:
No tests were executed!
It worked a couple of minutes ago, but now it stopped ...
10
votes
4answers
3k views
Selenium and Firefox 9's “Will you help improve Mozilla Firefox” popup
I'm trying to test a Java web app using Selenium 2.16.1. When Selenium opens Firefox, I see a band at the top of the page with message "Will you help improve Mozilla Firefox"
For some reason this ...
10
votes
3answers
16k views
Selenium webdriver: finding all elements with similar id
I have this xpath: //*[@id="someId::button"]
Pressing it shows a dropdown list of values.
Now, I know all the elements in the list have an id like this :
//*[@id="someId--popup::popupItemINDEX"]
...
9
votes
6answers
17k views
File Upload using Selenium WebDriver and Java
I am using Selenium WebDriver and Java and I need to automate the file upload feature. I tried a lot, but the moment the Browse button is clicked and a new window opens the script stops executing ...
9
votes
3answers
10k views
Selenium. How to click a link who's href has a certain substring?
The following is a bunch of links <a elements. ONLY one of them has a substring "long" as a value for the attribute href
<a class="c1" href= "very_lpng string" > name1 </a>
<a ...
9
votes
2answers
6k views
How do I get an parent HTML Tag with Selenium WebDriver using Java
I have a Test which search for <span class="legend">. On a previous level I have a fieldset which contains several values. Here is my problem. I don't get the locator for this fieldset.
First ...
9
votes
2answers
15k views
Selenium Web Driver : Handle Confirm Box using Java
Hi I am using the following code for handling the alert box after clicking an action but it isn't working
Can somebody please help.
This is where I call the handler. clickOnAlert() after ...
9
votes
3answers
2k views
HtmlUnit + Selenium within Production
I am currently using HtmlUnit and Selenium to drive it (WebDriver) within my production code.
I am scaping and interacting with various websites programmatically with these libraries and am having ...
9
votes
2answers
2k views
In Java, best way to check if Selenium WebDriver has quit
I need to check a collection of Page Objects to see, for each one, if quit() has been called on its WebDriver.
I've written the following method to check a WebDriver's state:
public static boolean ...
9
votes
2answers
5k views
How to implement WebDriver PageObject methods that can return different PageObjects
I've just started using WebDriver, and I'm trying to learn the best practices, in particular using PageObjects and PageFactory.
It's my understanding that PageObjects should expose the various ...
9
votes
4answers
2k views
Temporarily bypassing implicit waits with WebDriver
When using implicit waits, as advised here, I still sometimes want to assert the immediate invisibility or non-existence of elements.
In other words, I know some elements should be hidden, and want ...
9
votes
9answers
24k views
How do you get selenium to recognize that a page loaded?
In certain unknown situations selenium does not detect that a page has loaded when using the open method. I am using the Java API. For example (This code will not produce this error. I don't know of ...
9
votes
1answer
2k views
handling “are you sure you want to navigate away from this page” Msg in Selenium 2.0
Using Selenium 2.0
After Submitting a web form, A popup msg comes up with the "are you sure you want to navigate away from this page" message, How do I get selenium to press OK or disable this popup?
...
9
votes
6answers
9k views
Failed to connect to binary FirefoxBinary with Selenium in Maven
I am running some Selenium-Tests. When I start them directly from Eclipse everything works fine. But when I Start them through Maven there the following Exception occurs:
...
8
votes
3answers
23k views
handling iframe in webdriver
<div>
<iframe id="cq-cf-frame ">
<iframe id="gen367">
<body spellcheck="false" id="CQrte" style="height: 255px; font-size: 12px; ...
8
votes
5answers
21k views
isElementPresent in selenium 2.0
Hello all
I am using webdriver so if I want to use selenium;s rc function isElementPresent I have to emulate selenium rc so I do something like this:
import org.openqa.selenium.By;
import ...
8
votes
3answers
2k views
Selenium Unit Test using JUnit (Java)
I just want to quickly ask, I found all over the internet and even here on SO, how Selenium IDE can create Java source files from what you are doing in browser. But all these sources result in some ...
8
votes
3answers
13k views
Running Selenium scripts from Jmeter
I have Selenium automation scripts ready with functional flow, now i want to integrate those scripts with jmeter for load-testing.
Is that possible?
If so how to integrate both?
My first aim is to ...
8
votes
2answers
32k views
How do you use Selenium to execute javascript within a frame?
I have a page (index.html) which has a frame:
<html>
<body>
<iframe src="otherPage.html" />
</body>
</html>
And the otherPage.html has the contents:
<html>
...
8
votes
5answers
25k views
How to get Firefox working with Selenium WebDriver on Mac OSX
I am trying to config proxy settings for the WebDriver so I have used the following code ....
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.proxy.type", 1);
...
8
votes
5answers
52k views
Selenium - Could not start Selenium session: Failed to start new browser session: Error while launching browser
I am new to Selenium. I generated my first java selenium test case and it has compiled successfully. But when I run that test I got the following RuntimeException
java.lang.RuntimeException: Could ...
8
votes
2answers
4k views
How can I consistently remove the default text from an input element with Selenium?
I'm trying to use Selenium WebDriver to input text to a GWT input element that has default text, "Enter User ID". Here are a few ways I've tried to get this to work:
searchField.click();
...
8
votes
2answers
852 views
Error running Selenium IDE "Error: Permission denied to access property 'nr@context'
Starting this morning (4/3/14), I have been getting errors when my Selenium IDE tests run against my site. These tests were working just fine yesterday. I am running FF 25, Selenium IDE 2.5.0. ...
8
votes
4answers
2k views
Executing tests Concurrently on different OS and Browsers with WebDriver using Java and TestNG
I have configured grid in my system and written my test script. I can run my test on any specified OS and any Browser but only on one OS and one Browser at one time not all OS and all Browser ...