0

I would like to click on the element "Project" to display the dropdown list (see image below) Using the selenium library in python elsewhere i get the error :

could not be scrolled into view

which is obtained, for instance, using this code:

driver = webdriver.Firefox()
driver.get(url)
driver.find_element_by_xpath('//div[@class="multiselect-container"]').click()

or using some code where I wait the element to be displayed, for instance like described here: Message: Element <option> could not be scrolled into view while trying to click on an option within a dropdown menu through Selenium

mySelectElement = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "edit-projects")))
mySelectElement.click()

But I can't get it working.

Any would be appreciated.

The html source code may be found here:

https://rpidejr.hopto.org/f/8a909b51dcc34d09a00a/

enter image description here

1 Answers1

0

I saved the source code file to my drive as test.html and opened it and click on the Project box with the below code. Just edit the paths to your local machine.

from selenium import webdriver
import time

driver = webdriver.Firefox(executable_path=r'C:\\Path\\To\\geckodriver.exe')

driver.get("file:///C:/Path/To/test.html")

time.sleep(1)
#project = driver.find_element_by_xpath("//select[@id='edit-projects']")
#project.click()

project_elements = driver.find_elements_by_xpath("//select[@id='edit-projects']")
for element in project_elements:
    try:
        element.click()
    except Exception as e:
        print(e)
Jortega
  • 3,616
  • 1
  • 18
  • 21
  • yeah indeed it worked locally. However when I want to try "online", this code raised: " selenium.common.exceptions.ElementNotInteractableException: Message: Element –  Dec 18 '19 at 08:12
  • It sounds like there is another element with the same id on the page. I'll edit the answer to try getting all the elements with that id and then trying to click on all of them. – Jortega Dec 18 '19 at 13:00
  • indeed there is an element with the same id (the button "Catégories de tâches"). again I have the error message : Message: Element –  Dec 18 '19 at 19:11
  • I updated the source document containing the two ids –  Dec 18 '19 at 19:14