I am trying to create a test that clicks a menu item in an accordian, but selenium cannot find the element because it is hidden. I am not the developer for the app so i cannot change the code.I would like to click this item:I am currently using this codedriver.FindElement(By.XPath("//span[contains(.,'Organization')]")).Click();
I have tried a slew of ways to get to this element but i always get the same error from NUnit: OpenQA.Selenium.ElementNotVisibleException : Element is not currently visible and so may not be interacted with.
Is there any way to click this link? Or will it have to be a css change?
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/TmeU9XrCmtwJ.
For more options, visit https://groups.google.com/groups/opt_out.
I am trying to create a test that clicks a menu item in an accordian, but selenium cannot find the element because it is hidden. I am not the developer for the app so i cannot change the code.I would like to click this item:I am currently using this codedriver.FindElement(By.XPath("//span[contains(.,'Organization')]")).Click();
I have tried a slew of ways to get to this element but i always get the same error from NUnit: OpenQA.Selenium.ElementNotVisibleException : Element is not currently visible and so may not be interacted with.
Is there any way to click this link? Or will it have to be a css change?
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/TmeU9XrCmtwJ.
I would suggest you make it visible the way a user of the site would make it visible.
Interacting with disabled elements is not a true emulation of what the end user is doing and as a result not a realistic test…
From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of Stefan Teixeira
Sent: 31 July 2012 00:09
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] Selenium WebDriver - FindElement By XPath but the Span and Link have visibility Hidden
Nathan, when the element isn't visible, you can't interact with it in Selenium WebDriver. I suggest you two options:
1 - use WebDriverBackedSelenium, which is an implementation of Selenium RC in WebDriver. Your code would look just like that:
Selenium selenium = new WebDriverBackedSelenium(driver, "http://urlHere");
selenium.click("id=elementId");
driver = ((WrapsDriver) selenium).getWrappedDriver();
(check this blog: http://selenium2advanced.blogspot.com.br/2012/01/advancetopics.html)
2 - use the JavascriptExecutor class, check the API: http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/JavascriptExecutor.html
Regards,
Stefan.
2012/7/26 Nathan T <nathan...@gmail.com>
I am trying to create a test that clicks a menu item in an accordian, but selenium cannot find the element because it is hidden. I am not the developer for the app so i cannot change the code.
I would like to click this item:
I dont think the issue is with Selenium not being able to find the element. I think the issue is with selenium not being able to operate on the element in question because it is not visible. Perhaps one of its parents is hidden.
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
On Thu, Jul 26, 2012 at 10:38 PM, Nathan T <nathan...@gmail.com> wrote:
I am trying to create a test that clicks a menu item in an accordian, but selenium cannot find the element because it is hidden. I am not the developer for the app so i cannot change the code.I would like to click this item:I am currently using this codedriver.FindElement(By.XPath("//span[contains(.,'Organization')]")).Click();
I have tried a slew of ways to get to this element but i always get the same error from NUnit: OpenQA.Selenium.ElementNotVisibleException : Element is not currently visible and so may not be interacted with.
Is there any way to click this link? Or will it have to be a css change?
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
"//div[@id='ctl00_menu2_radPanel']/ul/li[3]/div/ul/li/a/span/span[text()='Organizations']"for (int second = 0;; second++) {
if (second >= 60) Assert.Fail("timeout");
try
{
if (IsElementPresent(By.XPath("//div[@id='ctl00_menu2_radPanel']/ul/li[3]/div/ul/li/a/span/span[text()='Organizations']"))) break ;
}
catch (Exception)
{}
Thread.Sleep(1000);
}
driver.FindElement(By.XPath("//div[@id='ctl00_menu2_radPanel']/ul/li[3]/div/ul/li/a/span/span[text()='Organizations']")).Click();