2011-05-02 17 views
36

¿Dónde puedo encontrar los "documentos API" para las vinculaciones de Python para Selenium WebDriver?¿Dónde está la documentación de la API Python de WebDriver?

http://code.google.com/p/selenium/wiki/PythonBindings

+1

Gracias, pero que podría haber acaba de publicar un enlace a ella. – Keith

+0

Y debe proporcionar una oración de introducción y un enlace a "WebDriver" (cualquiera que sea). – ThomasH

+0

@Keith: no hay ningún enlace. De ahí el objetivo de publicarlo aquí. –

Respuesta

11

sólo pensé que comparto esto en caso de que pueda ser útil.

add_cookie 
========== 
Adds a cookie to your current session. 
     Args: 
      cookie_dict: A dictionary object, with the desired cookie name as the key, and 
      the value being the desired contents. 
     Usage: 
      driver.add_cookie({'foo': 'bar',}) 


back 
==== 
Goes one step backward in the browser history. 
     Usage: 
      driver.back() 


capabilities 
============ 
dict() -> new empty dictionary 
dict(mapping) -> new dictionary initialized from a mapping object's 
    (key, value) pairs 
dict(iterable) -> new dictionary initialized as if via: 
    d = {} 
    for k, v in iterable: 
     d[k] = v 
dict(**kwargs) -> new dictionary initialized with the name=value pairs 
    in the keyword argument list. For example: dict(one=1, two=2) 

close 
===== 
Closes the current window. 
     Usage: 
      driver.close() 


command_executor 
================ 
A connection with the Remote WebDriver server. 

    Communicates with the server using the WebDriver wire protocol: 
    http://code.google.com/p/selenium/wiki/JsonWireProtocol 


create_web_element 
================== 
Creates a web element with the specified element_id. 

current_url 
=========== 
unicode(string [, encoding[, errors]]) -> object 

Create a new Unicode object from the given encoded string. 
encoding defaults to the current default string encoding. 
errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'. 

current_window_handle 
===================== 
unicode(string [, encoding[, errors]]) -> object 

Create a new Unicode object from the given encoded string. 
encoding defaults to the current default string encoding. 
errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'. 

delete_all_cookies 
================== 
Delete all cookies in the scope of the session. 
     Usage: 
      driver.delete_all_cookies() 


delete_cookie 
============= 
Deletes a single cookie with the given name. 
     Usage: 
      driver.delete_cookie('my_cookie') 


error_handler 
============= 
Handles errors returned by the WebDriver server. 

execute 
======= 
Sends a command to be executed by a command.CommandExecutor. 
     Args: 
      driver_command: The name of the command to execute as a string. 
      params: A dictionary of named parameters to send with the command. 
     Returns: 
      The command's JSON response loaded into a dictionary object. 


execute_async_script 
==================== 
Asynchronously Executes JavaScript in the current window/frame. 
     Args: 
      script: The JavaScript to execute. 
      args: Any applicable arguments for your JavaScript. 
     Usage: 
      driver.execute_async_script('document.title') 


execute_script 
============== 
Synchronously Executes JavaScript in the current window/frame. 
     Args: 
      script: The JavaScript to execute. 
      *args: Any applicable arguments for your JavaScript. 
     Usage: 
      driver.execute_script('document.title') 


find_element 
============ 
'Private' method used by the find_element_by_* methods. 
     Usage: 
      Use the corresponding find_element_by_* instead of this. 


find_element_by_class_name 
========================== 
Finds an element by class name. 
     Args: 
      name: The class name of the element to find. 
     Usage: 
      driver.find_element_by_class_name('foo') 


find_element_by_css_selector 
============================ 
Finds an element by css selector. 
     Args: 
      css_selector: The css selector to use when finding elements. 
     Usage: 
      driver.find_element_by_css_selector('#foo') 


find_element_by_id 
================== 
Finds an element by id. 
     Args: 
      id_: The id of the element to be found. 
     Usage: 
      driver.find_element_by_id('foo') 


find_element_by_link_text 
========================= 
Finds an element by link text. 
     Args: 
      link_text: The text of the element to be found. 
     Usage: 
      driver.find_element_by_link_text('Sign In') 


find_element_by_name 
==================== 
Finds an element by name. 
     Args: 
      name: The name of the element to find. 
     Usage: 
      driver.find_element_by_name('foo') 


find_element_by_partial_link_text 
================================= 
Finds an element by a partial match of its link text. 
     Args: 
      link_text: The text of the element to partially match on. 
     Usage: 
      driver.find_element_by_partial_link_text('Sign') 


find_element_by_tag_name 
======================== 
Finds an element by tag name. 
     Args: 
      name: The tag name of the element to find. 
     Usage: 
      driver.find_element_by_tag_name('foo') 


find_element_by_xpath 
===================== 
Finds an element by xpath. 
     Args: 
      xpath: The xpath locator of the element to find. 
     Usage: 
      driver.find_element_by_xpath('//div/td[1]') 


find_elements 
============= 
'Private' method used by the find_elements_by_* methods. 
     Usage: 
      Use the corresponding find_elements_by_* instead of this. 


find_elements_by_class_name 
=========================== 
Finds elements by class name. 
     Args: 
      name: The class name of the elements to find. 
     Usage: 
      driver.find_elements_by_class_name('foo') 


find_elements_by_css_selector 
============================= 
Finds elements by css selector. 
     Args: 
      css_selector: The css selector to use when finding elements. 
     Usage: 
      driver.find_element_by_css_selector('#foo') 


find_elements_by_id 
=================== 
Finds multiple elements by id. 
     Args: 
      id_: The id of the elements to be found. 
     Usage: 
      driver.find_element_by_id('foo') 


find_elements_by_link_text 
========================== 
Finds elements by link text. 
     Args: 
      link_text: The text of the elements to be found. 
     Usage: 
      driver.find_elements_by_link_text('Sign In') 


find_elements_by_name 
===================== 
Finds elements by name. 
     Args: 
      name: The name of the elements to find. 
     Usage: 
      driver.find_elements_by_name('foo') 


find_elements_by_partial_link_text 
================================== 
Finds elements by a partial match of their link text. 
     Args: 
      link_text: The text of the element to partial match on. 
     Usage: 
      driver.find_element_by_partial_link_text('Sign') 


find_elements_by_tag_name 
========================= 
Finds elements by tag name. 
     Args: 
      name: The tag name the use when finding elements. 
     Usage: 
      driver.find_elements_by_tag_name('foo') 


find_elements_by_xpath 
====================== 
Finds multiple elements by xpath. 
     Args: 
      xpath: The xpath locator of the elements to be found. 
     Usage: 
      driver.find_elements_by_xpath("//div[contains(@class, 'foo')]") 


forward 
======= 
Goes one step forward in the browser history. 
     Usage: 
      driver.forward() 


get 
=== 
Loads a web page in the current browser session. 

get_cookie 
========== 
Get a single cookie by name. Returns the cookie if found, None if not. 
     Usage: 
      driver.get_cookie('my_cookie') 


get_cookies 
=========== 
Returns a set of dictionaries, corresponding to cookies visible in the 
     current session. 
     Usage: 
      driver.get_cookies() 


get_current_window_handle 
========================= 
Returns the handle of the current window. 
     Usage: 
      driver.get_current_window_handle() 
     Note: this method has been deprecated. Please use current_window_handle 
      property" 


get_page_source 
=============== 
Gets the source of the current page. 
     Usage: 
      driver.get_page_source() 
     Note: 
      This call has been deprecated. Please use page_source property 


get_screenshot_as_base64 
======================== 
Gets the screenshot of the current window as a base64 encoded string which 
     is useful in embedded images in HTML. 
     Usage: 
      driver.get_screenshot_as_base64() 


get_screenshot_as_file 
====================== 
Gets the screenshot of the current window. Returns False if there is 
     any IOError, else returns True. Use full paths in your filename. 
     Args: 
      filename: The full path you wish to save your screenshot to. 
     Usage: 
      driver.get_screenshot_as_file('/Screenshots/foo.png') 


get_window_handles 
================== 
Returns the handles of all windows within the current session. 
     Usage: 
      driver.get_window_handles() 
     Note: this method has been deprecated. Please use window_handles 
      property 


implicitly_wait 
=============== 
Sets a sticky timeout to implicitly wait for an element to be found, 
     or a command to complete. This method only needs to be called one time per session. 
     Args: 
      time_to_wait: Amount of time to wait 
     Usage: 
      driver.implicitly_wait(30) 


name 
==== 
unicode(string [, encoding[, errors]]) -> object 

Create a new Unicode object from the given encoded string. 
encoding defaults to the current default string encoding. 
errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'. 

page_source 
=========== 
unicode(string [, encoding[, errors]]) -> object 

Create a new Unicode object from the given encoded string. 
encoding defaults to the current default string encoding. 
errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'. 

quit 
==== 
Quits the driver and closes every associated window. 
     Usage: 
      driver.quit() 


refresh 
======= 
Refreshes the current page. 
     Usage: 
      driver.refresh() 


session_id 
========== 
unicode(string [, encoding[, errors]]) -> object 

Create a new Unicode object from the given encoded string. 
encoding defaults to the current default string encoding. 
errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'. 

set_script_timeout 
================== 
Set the amount of time that the script should wait before throwing an 
      error. 
     Args: 
      time_to_wait: The amount of time to wait 
     Usage: 
      driver.set_script_timeout(30) 


start_client 
============ 
Called before starting a new session. This method may be overridden 
     to define custom startup behavior. 

start_session 
============= 
Creates a new session with the desired capabilities. 
     Args: 
      browser_name: The name of the browser to request. 
      version: Which browser version to request. 
      platform: Which platform to request the browser on. 
      javascript_enabled: Whether the new session should support JavaScript. 
      browser_profile: A browser profile directory as a Base64-encoded 
       zip file. Only used if Firefox is requested. 


stop_client 
=========== 
Called after executing a quit command. This method may be overridden 
     to define custom shutdown behavior. 

switch_to_active_element 
======================== 
Returns the element with focus, or BODY if nothing has focus. 
     Usage: 
      driver.switch_to_active_element() 


switch_to_alert 
=============== 
Switches focus to an alert on the page. 
     Usage: 
      driver.switch_to_alert() 


switch_to_default_content 
========================= 
Switch focus to the default frame. 
     Usage: 
      driver.switch_to_default_content() 


switch_to_frame 
=============== 
Switches focus to the specified frame, by index or name. 
     Args: 
      index_or_name: The name of the window to switch to, or 
      an integer representing the index to switch to. 
     Usage: 
      driver.switch_to_frame('frame_name') 
      driver.switch_to_frame(1) 


switch_to_window 
================ 
Switches focus to the specified window. 
     Args: 
      window_name: The name of the window to switch to. 
     Usage: 
      driver.switch_to_window('main') 


title 
===== 
unicode(string [, encoding[, errors]]) -> object 

Create a new Unicode object from the given encoded string. 
encoding defaults to the current default string encoding. 
errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'. 

window_handles 
============== 
list() -> new empty list 
list(iterable) -> new list initialized from iterable's items 
+0

+1 Realmente no parece haber una documentación API accesible; en la página enlazada de WebDriver solo dicen "importar e invocar dir () para averiguar" :-). – ThomasH

+0

+1 Me gusta :). Incluso está en el código fuente, debería estar en internet (incluso solo para googlear);) –

-5

Si bien es bueno cuando los desarrolladores poner un investigables API Docs en línea, es una práctica común en Python para simplemente generar por sí mismo a partir del código fuente cuando lo necesite, utilizando un generador doc como epydoc o similares .

+0

Es posible que esté dando buenos consejos, pero no está ayudando con la pregunta SO, es decir, el enlace de documentación. – igaurav

Cuestiones relacionadas