在Selenium Web驱动程序python

时间:2018-09-16 16:00:57

标签: python-3.x selenium-webdriver

如何使用python-selenium Web驱动程序在每次新运行脚本时在谷歌浏览器中打开相同的会话? 我正在使用此代码访问Whats App网站,但是每次我应该扫描QR码::

driver = webdriver.chrome()



driver.get("https://web.whatsapp.com/")
wait = WebDriverWait(driver, 1500)
target = '"john"'
string = "helloo"


x_arg = '//span[contains(@title,' + target + ')]'
group_title = wait.until(EC.presence_of_element_located((By.XPATH, x_arg)))
group_title.click()
inp_xpath = '//*[@id="main"]/footer/div[1]/div[2]/div/div[2]'
input_box = wait.until(EC.presence_of_element_located((By.XPATH, inp_xpath)))
input_box.send_keys(string + Keys.ENTER)
time.sleep(5)

那么我如何避免扫描并打开相同的会话?

0 个答案:

没有答案