Reputation: 2439
Hello I am working in Selenium Automation testing with Nunit. I have one grid which have bulk of users and there is one remove button on each row of the grid. But that Remove button is visible only on mouse hover. So when I run the script, It gives me the error -
Element is not currently visible and so may not be interacted with
The Xpath of button is
"//div[1]/div[2]/div/section/div[2]/div[contains(.,'IE8 john smith')]/div/div[2]/button[1]"
I tried working with the actions in selenium but still it gives me the same error.
Actions actions = new Actions(Driver);
var element = Driver.FindElement(By.XPath("//div[1]/div[2]/div/section/div[2]/div[contains(.,'" + fullName + "')]/div/div[2]/button[1]"));
actions.MoveToElement(element);
actions.Click();
actions.Perform();
Can anyone help me out ?
Upvotes: 1
Views: 1856
Reputation: 274
Try to force element to be visible using JS:
IWebElement element = driver.FindElement();
js.ExecuteScript("arguments[0].style.visibility = 'visible', arguments[0].style.height = '1px'; arguments[0].style.width = '1px'; arguments[0].style.opacity = 1", element);
element.Click();
Upvotes: 0
Reputation: 310
I think the following procedure will help
Upvotes: 3