Hi I am pretty new to select a select2 dropdown using Rselenium. (Normal select dropdown is ok but when it comes to AngularJS framework I have been struggling a lot.)

The field I want to click for the dropdown menu is Date Range so I look up in the html code (see picture below) and found


to be the pointer so I invoke command to click on the dropdown menu

webElem <- rd$client$findElement(using = 'xpath',
                         value = '//*[@class="select2-choice"]')

enter image description here

and then i confirmed the dropdown is active by looking at "select2-drop":

enter image description here

The value I want to click on is Custom:


Which is under


so I tried to click on it:

webElem <- rd$client$findElement(using = 'xpath', "//select[@id='namedRange-3640']/option[@value='custom']")


However the option "Custom" is not selected, the dropdown menu does not close and no warnings from webdriver? This select2 appears to be linking to a few other class... Can someone shed some light on this? Below is the html related to this dropdown menu.


enter image description here

  • select[@id='namedRange-3640']/option[@value='custom']" when use this localor in chrome dev tool how many elements is being selected – PDHide Jun 6 at 22:26
  • Hi PDHide, there is one element found in chrome dev tool typing in "//select[@id='namedRange-3640']/option[@value='custom']" which is exactly highlighting the last option in the html – Gabriel Jun 10 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.