Bahubali Patil
Bahubali Patil

Reputation: 1135

How to click on Hidden Links using robotframework

There is hidden link on a page. It appears only when manually mouse hovered over it.

But as a part of automation, I tried to use the following keywords and not fruitful result:

Mouse Over <XPATH to the link>
or
Click <XPATH to the link>

I got the below error :

ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with

Upvotes: 2

Views: 3786

Answers (3)

Bahubali Patil
Bahubali Patil

Reputation: 1135

I'm working with the Firefox browser.

As suggested by the @supraja reddy , first I mousehovered on the parent and then on the final element. I worked.

Below the code snippet :

Mouse Over  id=${parent_id}
Mouse Over  id=${child_id}
Click Link  id=${child_id}

Upvotes: 1

supraja reddy
supraja reddy

Reputation: 19

I have faced the same issue(when the element is at the bottom of the page and we need to scroll to find that element). I have come up with below steps.

1.Mouse hover over the target element(or parent)which ever the driver can determine the element.(Ex: Mouse Over > Xpath of element)

You can add sleep or wait to find the element in between 1 & 2.

2.Now click on the Target element.(Ex: Click Element > Xpath of target element)

It should work in chrome.(I haven't tried in IE or FF).

Hopefully this might help you

Upvotes: 1

shicky
shicky

Reputation: 2126

What browser are you using? If it's IE, you will not be able to solve this problem due to how it handles mouse events - https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver

An alternative may be to use the 'Simulate' Keyword or execute it using javascript, my preference is to use the keyboard and take advantage of tab ordering.

This shouldn't be an issue in other browsers unless your locators are poor.

Upvotes: 1

Related Questions