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
3
votes
1 answer

Firefox doesn't open when calling Webdriver in Python from PHP script

I have a python script calling the selenium webdriver for Firefox. That works fine if I call the Python script from CMD but not when called from a simple PHP page. I have tried multiple things and simplified my scripts but no luck. A similar script…
remyremy
  • 3,548
  • 3
  • 39
  • 56
3
votes
2 answers

Python Selenium - override geolocation not working

I'm trying to navigate to Google Maps using selenium webdriver while emulating a different location in Python. This doesn't seem to work: from selenium import webdriver driver = webdriver.Chrome() params = { "latitude": 42.1408845, …
3
votes
1 answer

Browsers not visible when running Selenium2/Webdriver tests with Hudson

I am using Hudson CI to run an ant script which compiles and executes Selenium2/Webdriver tests (written as TestNG tests). These tests are set to run in a Firefox browser, not with headless HTMLUnit. During the Hudson build, I don't see any errors…
SlimDavid
  • 81
  • 1
  • 5
3
votes
1 answer

How can I search for a HTML element using Python? Python Web Bot Error

I'm following a tutorial to create a bot that can perform tasks on any web page. I am using Python3 to search any random website, then using the search results (from that site) to print data. I have imported a selenium webdriver, and have ensured…
jfog
  • 81
  • 6
3
votes
1 answer

ImportError: cannot import name 'webdriver' from 'selenium' error using Selenium and WebDriver through Python

I wanted to code a program with selenium, so I wanted to test it but: from selenium import webdriver When Im running this program, it says: ImportError: cannot import name 'webdriver' from 'selenium'
3
votes
1 answer

Hcaptcha + 2captcha/anticaptcha in Python Selenium Chromedriver

I am trying to bypass hcaptcha on cloudflare anti-ddos loading page using webdriver in python selenium. Basically i have got to the point when the token is put in h-captcha-response and g-recaptcha-response fields and i can submit hcaptcha form. The…
hen
  • 65
  • 1
  • 7
3
votes
0 answers

What is the setting for changing language in Safari through Selenium WebDriver?

I'm trying to change the default language in Safari through WebDriver. I know this is the way in Chrome: val chromeOptions = new ChromeOptions(); val prefs = new HashMap(); prefs.put("intl.accept_languages",…
user786045
  • 2,498
  • 4
  • 22
  • 18
3
votes
1 answer

Controlling Opera Driver from within .NET

How can I control Opera Driver https://github.com/operasoftware/operadriver/ (or even Opera the browser itself) on Windows from within the .NET framework? My goal is to make something similar to Browsershots.org
3
votes
2 answers

Clicking every button that contains a specific class name with ChromeDriver in C#

I am using ChromeDriver and I would like it to click every button on the page that contains a specific class name. using OpenQA.Selenium; using OpenQA.Selenium.Chrome; ChromeDriverService chromeDriverService =…
creed
  • 1,409
  • 1
  • 9
  • 18
3
votes
2 answers

How to handle lazy-loaded images in selenium?

Before marking as duplicate, please consider that I have already looked through many related stack overflow posts, as well as websites and articles. I have not found a solution yet. This question is a follow up to this question here Selenium…
3
votes
1 answer

How to set a custom name for the user-agent using Selenium and Python

I am using selenium + webdriver and trying testing different user agents. I am adding user agent like this for Chrome on Windows for example: option = Options() option.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64)…
cheshire
  • 1,109
  • 3
  • 15
  • 37
3
votes
1 answer

Html Agility Pack cannot find list option using xpath

This is related to my previous question, but it seems I have another corner case where Html Agility Pack doesn't work as expected. Here's the Html (stripped down to the essentials, and sensitive information removed):
Anders
  • 15,227
  • 5
  • 32
  • 42
3
votes
1 answer

How to fill login prompt with Webdriver IO?

I'm working on a CLI with OCLIF. In one of the commands, I need to simulate a couple of clicks on a web page (using the WebdriverIO framework for that). Before you're able to reach the desired page, there is a redirect to a page with a login prompt.…
Kaj Nelissen
  • 915
  • 10
  • 29
3
votes
1 answer

iOS 13 safaridriver can not create safari session

tl;dr: safaridriver very often not able to connect to mobileSafari on real iOS 13 device. mobileSafari seems to be in kind of suspended mode after webdriver connection has been closed. Only solution, to make further connects, is manually killing…
mperkh
  • 31
  • 3
3
votes
1 answer

How to download a file using selenium, java

I need to download a file (the url is a mp3 file) using selenium webdriver, using chrome. When I get that URL, the mp3 starts playing without downloading, is there any way to download? I need to download it through a proxy
Achintha
  • 51
  • 1
  • 6