0

This is the code which I'm validating but its not able to get the Logout option under the dropdown. I copied the XPath value of Logout from the dropdown.

code

code2

This is what the dropdown looks like.

drop

This is the error while validating the same.

TaskTimedOut: Task timed-out waiting for element to be visible using: By(xpath, //*[@id='settingsDd']/li3/a/span)

Actually what I figured out is the correct drop is not getting selected, instead of that there is a tour button which gets clicked & highlighted. I have taken the XPath of the dropdown itself, but the wrong click happens. If any syntax error, let me know. Please assist.

4
  • Is that dropdown expanded on click or on hover?
    – Alexey R.
    Commented Jan 11, 2019 at 14:58
  • @AlexeyR. it expands on hover
    – Salman
    Commented Jan 11, 2019 at 16:04
  • @Salman then please share your code how you hover the gear icon
    – Alexey R.
    Commented Jan 11, 2019 at 16:08
  • @AlexeyR.Edited with SS of code snippets
    – Salman
    Commented Jan 11, 2019 at 16:19

2 Answers 2

0

Looks like you're trying to click element to get your list expanded but you should actually hover it.

Instead of .then(function (el) { el.click(); $browser.sleep(4000); }) (line 120)

try this:

.then(function (el) { $browser.actions().mouseMove(el).perform(); $browser.sleep(4000); })

source of idea

0

well based on your error, element is not visible, try an implicily wait to make sure element is visible before trying to click/hover it (you have to figure out if it´s an actual click or hover as well)

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

Then make sure your xpath is working correctly by getting only 1 result, use the "chropath" extension for chrome, is free.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.