Jump to content

Recommended Posts

Posted

Hello, 

I need some help with React-select dropdown list? How to interact with it? All option are hidden. Example:

How to choose "Silver" from single value list on this page https://react-select.com/home using WebDriver (may be WD_ExecuteScript)?

I can only click on this using code, no idea how to choose 'Silver' without clicking. 

 

Local $website_link = 'https://react-select.com/home'

$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, $website_link)

$list = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='react-select-3-input']")
_WD_ElementAction($sSession, $list, 'click')

 

_WD_ElementAction($sSession, $list, 'value', 'Silver') doesn't work

Any idea how to do it in the easiest direct way? May be there is possibility to choose it somehow with WD_ExecuteScript?

I have already tried some instruction but no success.

 

_WD_ExecuteScript($sSession, "arguments[0].scrollIntoView();", "//input[@aria-activedescendant='react-select-3-option-9']")

 

Thank you for your help.

 

Posted

When you post code, please use the method shown in the link.  Here one way :

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='react-select-3-input']")
_WD_ElementAction($sSession, $sElement, 'value', "Silver")
Local $sAction = '{"actions":[{"type":"key","id":"keyboard_1","actions":[{"type":"keyDown","value":"\uE007"},{"type":"keyUp","value":"\uE007"}]}]}'
_WD_Action($sSession, "actions", $sAction)

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   1 member

×
×
  • Create New...