I want to perform following steps:
- Type some element (variable name - 'username') in the input area
- Dropdown suggestions open up. [declaration : username = "user2"]
Check if element 'username' is present in dropdown; if yes, then want to click on that element and done.
<span class="main-dropdown"> <div class="tt"> <span class="all-suggestions"> <div class="suggestion"> <p>user1</p> </div> <div class="suggestion"> <p>user2</p> </div> <div class="suggestion"> <p>user3</p> </div> </span> </div> </span>
I have tried following :
- @browser.div(:class,"suggestion").p(:text,username).wait_while_present @browser.div(:class,"suggestion").p(:text,username).click
- @browser.span(:class,"all-suggestions").div(:class,"suggestion").p(:text,username).wait_while_present @browser.span(:class,"all-suggestions").div(:class,"suggestion").p(:text,username).click
- @browser.span(:class,"main-dropdown").div(:class,"suggestion").p(:text,username).wait_while_present @browser.span(:class,"main-dropdown").div(:class,"suggestion").p(:text,username).click
Issue: 'user2' shows up in dropdown list but it is unable to click on that element from dropdown.
Any help would be appreciated.