Skip to content Skip to sidebar Skip to footer

Selenium Webdriver Without Making Server Of The Pc

I have read the comments below for this question: What are the differences between 'Selenium-server-standalone.jar' and 'Selenium Client & WebDriver'? I would like to ask: Can

Solution 1:

As per How Does WebDriver ‘Drive’ the Browser Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. These direct calls and the features they support depends on the browser you are using.

The WebDriver consists of three separate pieces.

  • First of all, there is the Browser itself (e.g. Firefox / Chrome).
  • Next, the language bindings provided by the Selenium project (i.e. the Driver).
  • The executable downloaded either from GeckoDriver or ChromeDriver repository which acts as a bridge between Browser Client and the Driver. This executable is called WebDriver which we often refer as the Server to keep things simple.

So to execute you test you would require all these three pieces.

  • Mostly you will be having Firefox and Chrome browsers installed in your local system.
  • Start a command prompt using the cmd.exe program and run the pip command as given below to install selenium.

    pip install selenium
    
  • You can find a detailed discussion in Python : no module named selenium

  • The GeckoDriver and ChromeDriver can be downloaded from the respective locations.
  • Now, you can execute your script which is as follows:

    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    
    driver = webdriver.Firefox(executable_path=r'C:\path\to\geckodriver.exe')
    driver.get("http://www.python.org")
    assert "Python" in driver.title
    elem = driver.find_element_by_name("q")
    elem.clear()
    elem.send_keys("pycon")
    elem.send_keys(Keys.RETURN)
    

Post a Comment for "Selenium Webdriver Without Making Server Of The Pc"