'Downloading from OneDrive with Selenium
I need help with scraping from OneDrive. I need to click download button from this page: https://onedrive.live.com/?cid=6C890C686174A5C6&id=6C890C686174A5C6%212518&parId=root&action=defaultclick Everytime I try XPATH it keeps changing and changing and I dont know more what to do. I tried CSS and still not working...
from selenium import webdriver
import webbrowser
import time
driver = webdriver.Chrome()
driver.get("https://login.live.com/")
driver.find_element_by_xpath('//*[@id="i0116"]').send_keys("xxxxxx")
driver.find_element_by_xpath('//*[@id="idSIButton9"]').click()
time.sleep(2)
driver.find_element_by_xpath('//*[@id="i0118"]').send_keys("xxxxxx")
driver.find_element_by_xpath('//*[@id="idSIButton9"]').click()
driver.find_element_by_xpath('//*[@id="idSIButton9"]').click()
driver.get("https://onedrive.live.com/?cid=6C890C686174A5C6&id=6C890C686174A5C6%212518&parId=root&action=defaultclick")
driver.find_element_by_class_name("od-Button od-ButtonBarCommand od-ButtonBarCommand--button").click()
Does anyone know how to solve it? Thanks
Solution 1:[1]
Seems the id is changing frequently. So, try to write a relevant XPath to that element without using id.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Methmal Godage |
