La guía paso a paso o código que verás en este artículo es la solución más sencilla y válida que encontramos a esta inquietud o problema.
Ejemplo 1: python selenium webdriver
from selenium importwebdriver
from selenium.webdriver.common.keys importKeys
driver =webdriver.Firefox()
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)assert"No results found." not in driver.page_source
driver.close()
Ejemplo 2: tutorial python de selenium webdriver
importos
from selenium importwebdriver
from selenium.webdriver.common.keys importKeys
# get the path of ChromeDriverServer
dir = os.path.dirname(__file__)
chrome_driver_path = dir +"chromedriver.exe"
# create a newChrome session
driver =webdriver.Chrome(chrome_driver_path)
driver.implicitly_wait(30)
driver.maximize_window()
# Navigatetothe application home page
driver.get("http://www.google.com")
# get the search textbox
search_field = driver.find_element_by_name("q")
# enter search keyword and submit
search_field.send_keys("Selenium WebDriver Interview questions")
search_field.submit()
# get the list of elements which are displayed after the search
# currently on result page using find_elements_by_class_name method
lists= driver.find_elements_by_class_name("r")
# get the number of elements found
print ("Found "+str(len(lists))+" searches:")
# iterate through each element and print the text that is
# name of the search
i=0for listitem in lists:
print (listitem.get_attribute("innerHTML"))
i=i+1if(i>10):break
# close the browser window
driver.quit()
Ejemplo 3: API de selenio
ActionChains(driver).key_down(Keys.CONTROL).send_keys('c').key_up(Keys.CONTROL).perform()
Te invitamos a avalar nuestro trabajo ejecutando un comentario o puntuándolo te damos las gracias.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)