Questions tagged [webdriver]

WebDriver is an API for controlling web browsers, imitating a real user. It's mostly used for automated tests. WebDriver has multiple language bindings and drivers (allowing to control various browsers). If your question is specific to one of them, make sure to also include the appropriate tag.

WebDriver is an API that allows programs or scripts to introspect into, and control the behavior of, a web browser. It is primarily intended for allowing tests that automate a browser.

The WebDriver API is implemented, natively or via add-ons, for many browsers. The Selenium tools suite provides several WebDriver implementations, e.g. for Firefox or Internet Explorer. Other WebDriver implementations are developed by the browser projects directly, e.g. ChromeDriver for Chrome, or Ghost Driver for PhantomJS.

The WebDriver API specifies a wire protocol which is used for the communication between a WebDriver client and the browser. Clients do not speak the wire protocol directly, they use "language bindings" of the WebDriver API for the respective programming language. The wire protocol is used by the Selenium Grid to pass API commands across network.

There are language bindings of the WebDriver API for Java, C#, Python, Ruby, Perl, PHP, JavaScript, and other languages. Many of the language bindings are provided by the Selenium project. For some languages, there are even multiple language bindings, e.g. WebDriverJs by Selenium and WebdriverJS by webdriver.io.


Reference Links

12238 questions
125
votes
11 answers

Is it possible to run selenium (Firefox) web driver without a GUI?

We are considering upgrading our production server from Ubuntu-desktop 10.04 to Ubuntu-server 12.04. We have various services running on our current desktop OS such as Selenium Web Driver. My question is can the Selenium Web Driver be run from a…
nonshatter
  • 3,347
  • 6
  • 23
  • 27
121
votes
9 answers

Execute JavaScript using Selenium WebDriver in C#

How is this achieved? Here it says the java version is: WebDriver driver; // Assigned elsewhere JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("return document.title"); But I can't find the C# code to do this.
JontyMC
  • 6,038
  • 6
  • 38
  • 39
119
votes
14 answers

Checking if an element exists with Python Selenium

I have a problem; I am using the Selenium (Firefox) web driver to open a webpage, click a few links, etc., and then capture a screenshot. My script runs fine from the CLI, but when run via a cron job it is not getting past the first find_element()…
nonshatter
  • 3,347
  • 6
  • 23
  • 27
118
votes
13 answers

How can I ask the Selenium-WebDriver to wait for few seconds in Java?

I'm working on a Java Selenium-WebDriver. I added driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS); and WebElement textbox = driver.findElement(By.id("textbox")); because my Applications takes few seconds to load the User Interface.…
Gnik
  • 7,120
  • 20
  • 79
  • 129
113
votes
17 answers

unknown error: call function result missing 'value' for Selenium Send Keys even after chromedriver upgrade

I am getting the below error while sending keys. Result Message: System.InvalidOperationException : unknown error: call function result missing 'value' (Session info: chrome=65.0.3325.146) (Driver info: chromedriver=2.33.506120…
110
votes
12 answers

When running WebDriver with Chrome browser, getting message, "Only local connections are allowed" even though browser launches properly

When I run Chrome browser using WebDriver, I am getting following message on console. Please let me know how to resolve it. "Starting ChromeDriver (v2.10.267521) on port 22582 " "Only local connections are allowed." Here is my sample…
user3899403
  • 1,101
  • 2
  • 7
  • 3
110
votes
9 answers

How to set default browser window size in Protractor/WebdriverJS

For some reason when I run my tests at work the browser is maximized, but when I run them at home it only opens a browser window of about 50% width. This causes some discrepancies with scrolling down, etc., so I'd ideally like to have it open a…
jraede
  • 6,846
  • 5
  • 29
  • 32
105
votes
15 answers

Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection

I'm trying to automate a very basic task in a website using selenium and chrome but somehow the website detects when chrome is driven by selenium and blocks every request. I suspect that the website is relying on an exposed DOM variable like this…
Ajanth
  • 2,435
  • 3
  • 20
  • 23
104
votes
10 answers

C# Selenium 'ExpectedConditions is obsolete'

When trying to explicitly wait for an element to become visible using ExpectedConditions, Visual Studio warns me that it is now obsolete and will be removed from Selenium soon. What is the current/new method to achieve the same result? var wait =…
JohnWick
  • 4,929
  • 9
  • 37
  • 74
104
votes
9 answers

Selenium Web Driver & Java. Element is not clickable at point (x, y). Other element would receive the click

I used explicit waits and I have the warning: org.openqa.selenium.WebDriverException: Element is not clickable at point (36, 72). Other element would receive the click: ... Command duration or timeout: 393 milliseconds If I use…
Maria
  • 1,057
  • 2
  • 8
  • 7
103
votes
10 answers

How to select an option from drop down using Selenium WebDriver C#?

I was trying for my web test selecting an option. An example can be found here: http://www.tizag.com/phpT/examples/formex.php Everything works great except the selecting an option part. How to selecting an option by value or by label? My Code: using…
mirza
  • 5,685
  • 10
  • 43
  • 73
102
votes
10 answers

Selenium: FirefoxProfile exception Can't load the profile

Per this previous question I updated Selenium to version 2.0.1 But now I have another error, even when the profile files exist under /tmp/webdriver-py-profilecopy: File "/home/sultan/Repository/Django/monitor/app/request.py", line 236, in…
sultan
  • 5,978
  • 14
  • 59
  • 103
102
votes
3 answers

What is the difference between a CSS and XPath selector? And which is better with respect to performance for cross-browser testing?

I am working with the Selenium WebDriver 2.25.0 on a multilingual web application and mainly test the page content (for different languages, like Arabic, English, Russian, and so on). For my application, which is better according to performance and…
Chetan
  • 2,360
  • 3
  • 18
  • 33
96
votes
12 answers

How to switch to the new browser window, which opens after click on the button?

I have situation, when click on button opens the new browser window with search results. Is there any way to connect and focus to new opened browser window? And work with it, then return back to original(first) window.