Changes

Jump to navigation Jump to search
1,229 bytes added ,  12:58, 20 December 2017
no edit summary
The first step is to launch a driver. This is an object that has information on the current page including its url and web elements, and is the object you interact with to do any sort of navigation. First, import the webdriver:
from selenium import webdriver
 
Then, create an instance of the web driver. The RDP has bindings for Google Chrome and Mozilla Firefox. The following will launch a web browser on Google Chrome.
driver = webdriver.Chrome()
 
The GET method is used to visit a website. The get() command in Selenium takes a string url.
driver.get("http://www.google.com")
 
From here, different methods can be used to interact with the page. Most interactions involve some type of exchange with a web element. Selenium comes with many different ways to locate specific elements. To see the attributes of the element you want to work with, it is often a good idea to visit that page on your own browser, right click on the element you want your program to interact with, and select INSPECT. This will bring up the developer console and display the HTML representation of that element. From there, you can use one of the following selectors that best matches what you need.
 
===Selectors===
 
==Helpful Links==
[https://stackoverflow.com/questions/24795198/selenium-python-get-all-children-elements Selenium: Get Children Elements]
 
==Advanced==
The folder for the Web Driver Executables can be found:
C:\SeleniumDriver
 
chromedriver.exe is an executable to launch Google Chrome, and geckodriver.exe is an executable to launch Mozilla Firefox. Any new drivers for different web browsers should be placed in this folder.

Navigation menu