39 votes
Accepted

How do I work with dropdowns in Selenium Webdriver?

Using the Select Utility Class The big secret to working with dropdowns is that you don't want to work with them as WebElements, but instead create a Select element for them. The Select class (java ...
user avatar
  • 3,344
17 votes
Accepted

Can I use Selenium to do Desktop Application testing?

No, Selenium 2 / WebDriver is for web applications only. But there are other tools to automate desktop application GUI tests. http://en.wikipedia.org/wiki/List_of_GUI_testing_tools You can also ...
user avatar
  • 1,624
16 votes

Running WebDriver without opening actual browser window

It is quite easy to hide the browser without XVFB. Just install PhantomJS. Then, change this line: driver = webdriver.Firefox() to: driver = webdriver.PhantomJS() The rest of your code won't need ...
user avatar
14 votes
Accepted

How to Implement Page Object and Page Factory Pattern in Selenium Webdriver?

PageObjects The code of automated test cases should be easy to understand and not too complex. If a test fails, we want to know why and this as soon as possible. To allow this exists PageObjects. ...
user avatar
  • 1,624
14 votes
Accepted

How to send Basic Authentication headers in Selenium?

I've tested using format http://user:pass@host and it works. So in Python (in setUp() of MyClass(unittest.TestCase) class) this should look like: self.base_url = "http://user:pass@host" In Java ...
user avatar
  • 367
13 votes
Accepted

How to wait until the count of a web element changes in webdriver?

Thanks for your responses. But this is the script I'm using to resolve this issue public void waitUntilCountChanges() { WebDriverWait wait = new WebDriverWait(getDriver(), 5); wait....
user avatar
  • 581
12 votes

How can I reduce the execution speed in webdriver so that I can view properly what is happening on browser?

This is how I would debug a Selenium session to find out what is happening: Step-by-step debugging: Most IDE's allow you todo step-by-step debugging, you could set a break point just before the point ...
user avatar
12 votes

How to handle "Time out receiving message from the renderer" in chrome driver?

It looks like this issue has been logged as a bug for Selenium but has not yet been fixed: Issue 402: webdriver hangs on page load and does not give control back for script execution They are looking ...
user avatar
  • 8,419
12 votes
Accepted

Is it a bad practice to use implicit wait in Selenium Webdriver? Should one use only explicit wait?

Short answer: Yes it is a bad practise, unless you have a very very very good reason, do not use implicit wait. This Stack Overflow answers really puts the difference in great detail. (read this!) I ...
user avatar
12 votes

What do I need to do if dropdown takes more time to populate 1st element from dropdown list?

Do you think that time is the problem here? If so try to increase the time you are providing in Thread.sleep(); and see it that works out for you. If its not the time, then did you try to find out ...
user avatar
  • 131
11 votes

Faking system time/date with Selenium Webdriver?

The browser date/time functions are all JavaScript. You should be able to use Sinon.JS or TimeShift.JS to mock the date/time. Inject/Add the mocking framework during tests runs Mock the Date object ...
user avatar
11 votes

Unable to scroll down to bottom of div with data loading dynamically

Check below are the various methods to scroll your web page up & down: Scroll Down: import org.openqa.selenium.JavascriptExecutor; WebDriver driver = new FirefoxDriver(); JavascriptExecutor jse =...
user avatar
  • 6,749
10 votes

What are some tools for testing Mobile web apps?

There are a number of tools available for testing mobile apps: a) Robotium b) Uiautomator c) Espresso d) Appium e) Calabash But my experience -I can suggest you Appium is the best tool for both ...
10 votes

Not able to scroll down page using Selenium webdriver

Please use below code. driver.get("http://www.flipkart.com/"); driver.manage().window().maximize(); driver.findElement(By.linkText("Trimmer")).click(); WebElement scroll = driver.findElement(By.id("...
user avatar
  • 510
10 votes
Accepted

How do I split my PageObject Model classes?

No. Do not just split your pageObject into pageObject2, 3, 4, etc. This goes for all programming - split your classes logically by function, not arbitrarily! Your page object should be the source of ...
user avatar
8 votes

Running WebDriver without opening actual browser window

You used to be able to use PhantomJS for this, but since PhantomJS itself is discontinued, so is the Selenium PhantomJS driver. The good news is, that you can simply use Chrome. Chrome itself has ...
user avatar
  • 181
8 votes

Selenium test case fails due to page load time

You can use WebDriverWait to synch with page load. Something like the following might help WebDriverWait wait = new WebDriverWait(driver, 15); //you can play with the time integer to wait for longer ...
user avatar
  • 81
8 votes

What Concepts of Java do i need to learn to use Selenium Webdriver?

Java My experience is, that the basics of Java suffice to start developing test cases with Selenium 2 / WebDriver. Myself started developing of Selenium test cases with a basic knowledge about Java. ...
user avatar
  • 1,624
8 votes

How do I work with dropdowns in Selenium Webdriver?

Without the Select class Everything I listed in my other answer can, of course, be done with judicious use of selectors. Since the Select class doesn't exist in Ruby (to the best of my knowledge), ...
user avatar
  • 3,344
8 votes
Accepted

Efficent way of checking if Element is Not Present

List<WebElement> cheeses = driver.findElements(By.className("cheese")); findElements() does not wait, but returns list of elements (located by locator). List is empty if nothing is found (...
user avatar
7 votes
Accepted

How can I reduce the execution speed in webdriver so that I can view properly what is happening on browser?

You can try setting implicit wait time. (Documentation) // 5 seconds implicit wait (C# code) IWebDriver driver = new FirefoxDriver(); driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(...
user avatar
  • 209
7 votes

How to Implement Page Object and Page Factory Pattern in Selenium Webdriver?

Page Factory Pattern is like an extension to Page Object Model , but Page Factory is much enhanced model. To start with, we just need to import package org.openqa.selenium.support.PageFactory "...
user avatar
  • 6,749
7 votes
Accepted

How to change the Text of a IWebElement of Selenium in C#

Quickly glanced over the properties and methods of IWebElement, doesn't look like they can set values. However, you can easily execute some javascript snippet to change HTML in your page. IWebDriver ...
user avatar
  • 5,834
7 votes

How much SQL knowledge do I need to learn Selenium Testing

For writing Selenium tests itself, none. Selenium does not use SQL. Now if the application under test uses SQL, maybe you need a bit of knowledge to setup test data for your tests. For basic SQL ...
user avatar
7 votes

How to verify two images using Selenium WebDriver?

Selenium is a software library to locate elements on web page and interact with them. To deal with images, you need to use different library. Selenium can provide screenshots (images) but you need to ...
user avatar
6 votes

How to download a file using Selenium's WebDriver?

I made my own version of the downloader, by using an Ajax request and returning the bytes. Has the advantage that it uses the browser directly, so authentication and cookies do not need to be dealt ...
user avatar
  • 161
6 votes
Accepted

How to take ScreenShot & save it with different filenames by using Selenium & Java?

Two options: Generate a unique filename for each save, by appending a timestamp or a GUID. Also, see this question. public void screenShot() throws IOException, InterruptedException { File scr = ...
user avatar
6 votes
Accepted

What is the hierarchy to use for finding elements - ID, class, name, xpath?

My main criteria is readability and maintainability. Speed has never been as issue for me. There's other parts of the test frameworks I use that have much more significant speed issues. The basic ...
user avatar
6 votes

What are the things that one must consider while learning Selenium Webdriver Automation framework?

This is going to be blunt. I don't know a not-blunt way to say this. First, learn to code. Working with Selenium, no matter what your toolkit happens to be, is writing code. If you don't understand ...
user avatar
  • 30.8k
5 votes

What are some tools for testing Mobile web apps?

Top tools for testing mobile apps: Appium: Appium is an open-source tool for automating native, mobile web, and hybrid applications on iOS and Android platforms. Appium is "cross-platform": it allows ...

Only top scored, non community-wiki answers of a minimum length are eligible