The WebDriver implementation.
Controls a browser by sending commands to a remote server. This server is expected to be running the WebDriver wire protocol as defined here: http://code.google.com/p/selenium/wiki/JsonWireProtocol
| Attributes : |
|
|---|
Create a new driver that will issue commands using the wire protocol.
| Args : |
|
|---|
Adds a cookie to your current session.
| Args : |
|
|---|
Returns the handle of the current window.
| Usage : | driver.current_window_handle |
|---|
Delete all cookies in the scope of the session.
| Usage : | driver.delete_all_cookies() |
|---|
Deletes a single cookie with the given name.
| Usage : | driver.delete_cookie(‘my_cookie’) |
|---|
Sends a command to be executed by a command.CommandExecutor.
| Args : |
|
|---|---|
| Returns : | The command’s JSON response loaded into a dictionary object. |
Asynchronously Executes JavaScript in the current window/frame.
| Args : |
|
|---|---|
| Usage : | driver.execute_async_script(‘document.title’) |
Synchronously Executes JavaScript in the current window/frame.
| Args : |
|
|---|---|
| Usage : | driver.execute_script(‘document.title’) |
‘Private’ method used by the find_element_by_* methods.
| Usage : | Use the corresponding find_element_by_* instead of this. |
|---|
Finds an element by class name.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_class_name(‘foo’) |
Finds an element by css selector.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_css_selector(‘#foo’) |
Finds an element by id.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_id(‘foo’) |
Finds an element by link text.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_link_text(‘Sign In’) |
Finds an element by name.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_name(‘foo’) |
Finds an element by a partial match of its link text.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_partial_link_text(‘Sign’) |
Finds an element by tag name.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_tag_name(‘foo’) |
Finds an element by xpath.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_xpath(‘//div/td[1]’) |
‘Private’ method used by the find_elements_by_* methods.
| Usage : | Use the corresponding find_elements_by_* instead of this. |
|---|
Finds elements by class name.
| Args : |
|
|---|---|
| Usage : | driver.find_elements_by_class_name(‘foo’) |
Finds elements by css selector.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_css_selector(‘#foo’) |
Finds multiple elements by id.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_id(‘foo’) |
Finds elements by link text.
| Args : |
|
|---|---|
| Usage : | driver.find_elements_by_link_text(‘Sign In’) |
Finds elements by name.
| Args : |
|
|---|---|
| Usage : | driver.find_elements_by_name(‘foo’) |
Finds elements by a partial match of their link text.
| Args : |
|
|---|---|
| Usage : | driver.find_element_by_partial_link_text(‘Sign’) |
Finds elements by tag name.
| Args : |
|
|---|---|
| Usage : | driver.find_elements_by_tag_name(‘foo’) |
Finds multiple elements by xpath.
| Args : |
|
|---|---|
| Usage : | driver.find_elements_by_xpath(“//div[contains(@class, ‘foo’)]”) |
Get a single cookie by name. Returns the cookie if found, None if not.
| Usage : | driver.get_cookie(‘my_cookie’) |
|---|
Returns a set of dictionaries, corresponding to cookies visible in the current session.
| Usage : | driver.get_cookies() |
|---|
| Usage : | driver.get_screenshot_as_base64() |
|---|
| Args : |
|
|---|---|
| Usage : | driver.get_screenshot_as_file(‘/Screenshots/foo.png’) |
Gets the x,y position of the current window.
| Usage : | driver.get_window_position() |
|---|
Gets the width and height of the current window.
| Usage : | driver.get_window_size() |
|---|
| Args : |
|
|---|---|
| Usage : | driver.implicitly_wait(30) |
Gets the current orientation of the device
| Usage : | orientation = driver.orientation |
|---|
| Args : |
|
|---|---|
| Usage : | driver.set_page_load_timeout(30) |
| Args : |
|
|---|---|
| Usage : | driver.set_script_timeout(30) |
Sets the x,y position of the current window. (window.moveTo)
| Args : |
|
|---|---|
| Usage : | driver.set_window_position(0,0) |
Sets the width and height of the current window. (window.resizeTo)
| Args : |
|
|---|---|
| Usage : | driver.set_window_size(800,600) |
Called before starting a new session. This method may be overridden to define custom startup behavior.
Creates a new session with the desired capabilities.
| Args : |
|
|---|
Called after executing a quit command. This method may be overridden to define custom shutdown behavior.
Returns the element with focus, or BODY if nothing has focus.
| Usage : | driver.switch_to_active_element() |
|---|
Switch focus to the default frame.
| Usage : | driver.switch_to_default_content() |
|---|
Switches focus to the specified frame, by index, name, or webelement.
| Args : |
|
|---|---|
| Usage : | driver.switch_to_frame(‘frame_name’) driver.switch_to_frame(1) driver.switch_to_frame(driver.find_elements_by_tag_name(“iframe”)[0]) |