0

I am trying to use selenium to upload a file in google drive, but I am unable to select the upload file button.

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()
stackprotector
  • 10,498
  • 4
  • 35
  • 64
try
  • 1
  • 1

2 Answers2

1

I was having the same issue. In Google Drive, you need to perform a right click action, then use the arrow keys to access the File Upload option. See, this answer, on how to implement this using selenium.

DirtyDan
  • 11
  • 1
  • 4
0

If you are only trying to upload a file in google drive, there is a library called PyDrive.

ddoGas
  • 861
  • 7
  • 17