Python Forum
Click dropdown menu option with Selenium PyChrome
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Click dropdown menu option with Selenium PyChrome
#1
Hello! I'm trying to click on the button of "Suicide or self injury" inside the report menu of youtube. I have already clicked on the "Harmful dangerous acts" and open up the dropdown menu of "Choose one" but when I try to click the "Suicide or self injury" it gives me the error of ERROR:root:ElementNotVisibleException: Couldn't Click on this element.

I'm using selenium python PyChrome webdriver and the last part of my code is:

#open the "choose one" drop-menu
locator = "#options > paper-dropdown-menu:nth-child(11)" 
element = browser.findElement(css = locator)
browser.clickElement(element)
time.sleep(2)
#trying to choose the "Suicide or self injury" option
locator = "//*[@id='contentWrapper']/div/paper-listbox/paper-item[4]"
element = browser.findElement(xpath = locator)
browser.clickElement(element)
Reply
#2
try this xpath
//*[@id="contentWrapper"]/div/paper-listbox/paper-item[4]/yt-formatted-string
or CSS selector
#contentWrapper > div > paper-listbox > paper-item:nth-child(4) > yt-formatted-string
Recommended Tutorials:
Reply
#3
(Oct-26-2017, 09:35 PM)metulburr Wrote: try this xpath
//*[@id="contentWrapper"]/div/paper-listbox/paper-item[4]/yt-formatted-string
or CSS selector
#contentWrapper > div > paper-listbox > paper-item:nth-child(4) > yt-formatted-string

No, it keeps showing the ERROR:root:ElementNotVisibleException: Couldn't Click on this element. error Confused
Reply
#4
Do you have an example code snippet that gets to that point of error? Im too lazy to make my own at this point.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Generating dynamic dropdown list test 1 1,471 Aug-30-2023, 08:00 AM
Last Post: blessinguvula
  Selenium press "select option" button (SOLVED) kucingkembar 0 719 Aug-10-2023, 11:49 AM
Last Post: kucingkembar
  Click on a button on web page using Selenium Pavel_47 7 4,677 Jan-05-2023, 04:20 AM
Last Post: ellapurnellrt
  Python Selenium (Dropdown-) data Robin_at_Cantelli 2 6,198 Dec-29-2021, 03:16 AM
Last Post: ondreweil
  Selenium Python for Dropdown not working gj31980 1 2,659 Oct-27-2020, 02:02 AM
Last Post: gj31980
  Log In Button Won't Click - Python Selenium Webdriver samlee916 2 3,821 Jun-07-2020, 04:42 PM
Last Post: samlee916
  Dropdown interact moisesfelipee 0 1,675 May-04-2020, 01:11 AM
Last Post: moisesfelipee
  Hyperlink Click is not working in Selenium webdriver rajeev1729 0 2,023 May-02-2020, 11:21 AM
Last Post: rajeev1729
  selenium click in iframe fails 3Pinter 6 5,107 Apr-29-2020, 12:59 PM
Last Post: Larz60+
  While loop skips multiple dropdown menu options and then works as intended newbie_programmer 1 2,876 Dec-23-2019, 10:26 PM
Last Post: keuninkske

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020