【发布时间】:2020-06-15 00:24:46
【问题描述】:
#Required Boundaries
from selenium import webdriver
import time
#Opens Chrome Profile
options = webdriver.ChromeOptions()
options.add_argument("/Users/paolamohan/Library/Application Support/Google/Chrome/Default")
driver = webdriver.Chrome(executable_path=r"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",options=options)
time.sleep(2)
#Gmail
Gmail = driver.find_element_by_xpath('//*[@id="gb"]/div[2]/div[3]/div[1]/div/div[1]/a')
Gmail.click()
这是我的代码。我想出了如何让 Webdriver 使用我的 Chrome 配置文件打开 Chrome,但现在我在它执行后无法运行其他任何东西。对于这个简单的例子,我只想让脚本点击谷歌主页右上角的“Gmail”小图标
我是 Python 新手,所以任何编写的代码都会非常有用! 谢谢
【问题讨论】:
标签: python-3.x selenium selenium-webdriver