I am trying to upload files automatically with selenium in python to the website.
I succesfully added file to the library but stucked on the point where I the script should click ‘Use this file’ button:
I tried to use
driver.find_element_by_xpath('//*[@id="__wp-uploader-id-0"]/div[4]/div/div[2]/button').click()
but nothing happens.
tried also use actions:
actions = ActionChains(driver)
Element = driver.find_element_by_xpath('//*[@id="__wp-uploader-id-0"]/div[4]/div/div[2]/button')
actions.move_to_element(Element).click().perform();
but also no luck
Do you have any idea what else can I try?
3
Answers
OK it's solved, I had to add time wait until page is loaded fully.
Closing case
The simplest way is to use this:
if this
//*[@id="__wp-uploader-id-0"]/div[4]/div/div[2]/button
represent a single entity in DOM, you can probably use it with expicit waits :
having said that, I would still suggest you to use a relative xpath.