informatica:linux:selenium
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
informatica:linux:selenium [2019/09/23 12:24] – jose | informatica:linux:selenium [2019/09/23 19:29] – jose | ||
---|---|---|---|
Line 244: | Line 244: | ||
</ | </ | ||
- | ====== | + | ====== |
+ | ===== Firefox ===== | ||
Abrimos firefox en local. Escribimos en la barra **about: | Abrimos firefox en local. Escribimos en la barra **about: | ||
Line 251: | Line 253: | ||
driver = webdriver.Firefox(myprofile) | driver = webdriver.Firefox(myprofile) | ||
+ | ===== Chrome ===== | ||
+ | Simplemente le tenemos que indicar un directorio y ya lo graba ahí. Funciona con Chromedriver 70 a 73. Lo podemos descargar de:\\ | ||
+ | https:// | ||
+ | < | ||
+ | from selenium import webdriver | ||
+ | from selenium.webdriver.chrome.options import Options | ||
+ | |||
+ | CHROMEDRIVER_PATH = '/ | ||
+ | |||
+ | options = Options() | ||
+ | options.add_argument(' | ||
+ | |||
+ | options.add_argument(" | ||
+ | driver = webdriver.Chrome(CHROMEDRIVER_PATH, | ||
+ | </ | ||
+ | |||
+ | ===== Whatsapp ===== | ||
+ | ==== Enviar mensaje ==== | ||
+ | |||
+ | < | ||
+ | xpath = ' | ||
+ | o = driver.find_element_by_xpath(xpath) | ||
+ | o.click() | ||
+ | |||
+ | xpath = ' | ||
+ | o = driver.find_element_by_xpath(xpath) | ||
+ | o.send_keys(' | ||
+ | |||
+ | xpath = ' | ||
+ | o = driver.find_element_by_xpath(xpath) | ||
+ | o.click() | ||
+ | </ | ||
+ | ==== Adjuntar fichero ==== | ||
+ | < | ||
+ | xpath = ' | ||
+ | o = driver.find_element_by_xpath(xpath) | ||
+ | o.click() | ||
+ | |||
+ | xpath = ' | ||
+ | o = driver.find_element_by_xpath(xpath) | ||
+ | o.click() | ||
+ | |||
+ | o = driver.find_element_by_xpath("// | ||
+ | o.send_keys(os.getcwd()+"/ | ||
+ | xpath = ' | ||
+ | o = driver.find_element_by_xpath(xpath) | ||
+ | o.click() | ||
+ | </ |
informatica/linux/selenium.txt · Last modified: 2022/12/27 09:08 by jose