Posting pictures on facebook with java selenium: element not interactable

Viewed 115

I am trying to post some text and pictures on facebook with a little Java program.

I am not able to send any image since I cannot click the appropriate button with selenium.

Here is the part of code where I need to click the upload Photo/video button on:

driver.navigate().to(group);
                Thread.sleep(6000);
                driver.findElement(By.xpath("//div[@class='m9osqain a5q79mjw gy2v8mqq jm1wdb64 k4urcfbm qv66sw1b']//span[@class='a8c37x1j ni8dbmo4 stjgntxs l9j0dhe7']")).click();
                Thread.sleep(3000);
                driver.findElement(By.xpath("//div[@class='_1mf _1mj']")).sendKeys(testoPost);
                
                for (File f : images) {
                    driver.findElement(By.xpath("//div[@class='bp9cbjyn j83agx80 datstx6m taijpn5t l9j0dhe7 k4urcfbm']//i[@class='hu5pjgll bixrwtb6']")).sendKeys(f.getAbsolutePath());
                }

Selenium navigates to one of the groups written in a text file and then opens the text/post window. Everything works fine until then I receive this exception:

org.openqa.selenium.ElementNotInteractableException: element not interactable

I don't know how to click the link to upload pictures, namely the Photo/video icon.

Anyone can help?

Thanks, Saverio

screenshoot

Here is a screenshot of the html icon element I see when inspecting the upload button:

Upload Photo button element

0 Answers
Related