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 14:45] – jose | informatica:linux:selenium [2019/10/17 11:02] – jose | ||
---|---|---|---|
Line 146: | Line 146: | ||
====== Python firefox headless local ====== | ====== Python firefox headless local ====== | ||
+ | |||
+ | ===== Sin profile ===== | ||
+ | |||
**IMPORTANTE**: | **IMPORTANTE**: | ||
Line 157: | Line 160: | ||
from selenium.webdriver import Firefox | from selenium.webdriver import Firefox | ||
- | | + | # Local headless |
- | options.add_argument(' | + | options = Options() |
- | | + | options.headless |
- | d.set_window_size(1920, 1080) | + | driver |
- | | + | </ |
+ | |||
+ | ===== Con profile ===== | ||
+ | |||
+ | < | ||
+ | from selenium.webdriver.firefox.options import Options | ||
+ | from selenium.webdriver import Firefox, FirefoxProfile | ||
+ | |||
+ | # Local headless | ||
+ | options = Options() | ||
+ | options.headless = True | ||
+ | driver = Firefox(firefox_profile = profile, options = options) | ||
</ | </ | ||
Line 269: | Line 283: | ||
</ | </ | ||
- | ===== Whatsapp ===== | + | ====== Whatsapp ====== |
+ | ===== Enviar mensaje ===== | ||
< | < | ||
- | xpath = ' | + | xpath = ' |
o = driver.find_element_by_xpath(xpath) | o = driver.find_element_by_xpath(xpath) | ||
o.click() | o.click() | ||
Line 283: | Line 299: | ||
o.click() | 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() | ||
+ | </ | ||
+ | |||
+ | ======= Padres e hijos ======= | ||
+ | |||
+ | |||
+ |
informatica/linux/selenium.txt · Last modified: 2022/12/27 09:08 by jose