User Tools

Site Tools


informatica:linux:selenium

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
informatica:linux:selenium [2019/09/23 12:28] joseinformatica:linux:selenium [2019/09/23 19:29] jose
Line 267: Line 267:
 options.add_argument("window-size=1920,1080") options.add_argument("window-size=1920,1080")
 driver = webdriver.Chrome(CHROMEDRIVER_PATH, options=options) driver = webdriver.Chrome(CHROMEDRIVER_PATH, options=options)
 +</code>
 +
 +===== Whatsapp =====
 +==== Enviar mensaje ====
 +
 +<code>
 +xpath = './/span[contains(@title, "Armando Bronca")]'
 +o = driver.find_element_by_xpath(xpath)
 +o.click()
 +
 +xpath = './/div[contains(@class, "_3u328 copyable-text selectable-text")]'
 +o = driver.find_element_by_xpath(xpath)
 +o.send_keys('Mensaje enviado desde selenium')
 +
 +xpath = './/button[contains(@class, "_3M-N-")]'
 +o = driver.find_element_by_xpath(xpath)
 +o.click()
 +</code>
 +==== Adjuntar fichero ====
 +<code>
 +xpath = './/span[contains(@title, "Armando Bronca")]'
 +o = driver.find_element_by_xpath(xpath)
 +o.click()
 +
 +xpath = './/div[contains(@title, "Adjuntar")]'
 +o = driver.find_element_by_xpath(xpath)
 +o.click()
 +
 +o = driver.find_element_by_xpath("//input[@type='file']")
 +o.send_keys(os.getcwd()+"/tmp/caron.png")
 +
 +xpath = './/span[contains(@data-icon, "send-light")]'
 +o = driver.find_element_by_xpath(xpath)
 +o.click()
 </code> </code>
informatica/linux/selenium.txt · Last modified: 2022/12/27 09:08 by jose