【问题标题】:How to use selenium with python to upload a file in google drive?如何使用 selenium 和 python 在谷歌驱动器中上传文件?
【发布时间】:2020-12-18 01:36:37
【问题描述】:

我正在尝试使用 selenium 在谷歌驱动器中上传文件,但我无法选择上传文件按钮。

from selenium import webdriver as wd

driver = wd.Chrome()

driver.get("https://accounts.google.com/signin/v2/identifier?service=wise&passive=true&continue=http%3A%2F%2Fdrive.google.com%2F%3Futm_source%3Den&utm_medium=button&utm_campaign=web&utm_content=gotodrive&usp=gtd&ltmpl=drive&flowName=GlifWebSignIn&flowEntry=ServiceLogin")
#logging in to google drive
driver.maximize_window()
driver.implicitly_wait(10)
driver.find_element_by_name("identifier").send_keys("********@gmail.com")
driver.find_element_by_xpath("//*[@id='identifierNext']/div/button/div[2]").click()
driver.implicitly_wait(10)
driver.find_element_by_name("password").send_keys("*******")
driver.find_element_by_xpath("//*[@id='passwordNext']/div/button/div[2]").click()
driver.implicitly_wait(10)
driver.find_element_by_xpath("//*[@id='drive_main_page']/div[2]/div[1]/div[1]/div/div/div[2]/div[1]/div/button[1]/div[2]").click()

【问题讨论】:

    标签: python selenium file selenium-webdriver file-upload


    【解决方案1】:

    如果您只是想在 google 驱动器中上传文件,则有一个名为 PyDrive 的库。

    【讨论】:

    • 我想用 selenium 和 python 来上传图片
    猜你喜欢
    • 2018-11-10
    • 2018-07-28
    • 2021-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多