[xwiki-devs] Hover in Selenium2
Hi all, I'm writing integration tests for the patch fixing http://jira.xwiki.org/jira/browse/XABLOG-99. In particular, I want to test adding, renaming and deleting of blog categories from Blog/ManageCategories page. My problem is that the "toolbox" with rename and delete buttons is only displayed on hover, and selenium complains that it cannot access invisible elements. I tried to use RenderedWebElement.hover() as follows: By locator = By.xpath("//a[contains(@href, \"" + name + "\")]/ancestor::span[@class='blog-category-level']"); RenderedWebElement category = (RenderedWebElement) getDriver().findElement(locator); category.hover(); but the n I get error "Unable to hover over element". Does anybody knows how to show these delete buttons? I'm using FF 3.6 on Linux. Thanks, Alex
In case somebody is interested, I found a workaround on selenium mailing list. The trick is to execute some JavaScript that does what is needed, in my case just shows the element. By locator = By.xpath("//a[contains(@href, '" + name + "')]/ancestor::span[@class='blog-category-level']" + "//span[@class='blog-category-tools']"); WebElement category = getDriver().findElement(locator); if (getDriver() instanceof JavascriptExecutor) { JavascriptExecutor js = (JavascriptExecutor) getDriver(); // instead of hovering, just show the toolbox js.executeScript("arguments[0].style.visibility='visible'", category); } Alex On 03/18/2010 02:53 AM, Alex Busenius wrote:
Hi all,
I'm writing integration tests for the patch fixing http://jira.xwiki.org/jira/browse/XABLOG-99. In particular, I want to test adding, renaming and deleting of blog categories from Blog/ManageCategories page.
My problem is that the "toolbox" with rename and delete buttons is only displayed on hover, and selenium complains that it cannot access invisible elements.
I tried to use RenderedWebElement.hover() as follows:
By locator = By.xpath("//a[contains(@href, \"" + name + "\")]/ancestor::span[@class='blog-category-level']"); RenderedWebElement category = (RenderedWebElement) getDriver().findElement(locator); category.hover();
but the n I get error "Unable to hover over element".
Does anybody knows how to show these delete buttons? I'm using FF 3.6 on Linux.
Thanks, Alex _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Alex, We could add a helper method for this situation in BasePage, with a signature like: void makeElementVisible(By locator); Do you know if their is an issue in their tracker for this ? If they have plans to support it in the future? Regards, Jerome
In case somebody is interested, I found a workaround on selenium mailing list. The trick is to execute some JavaScript that does what is needed, in my case just shows the element.
By locator = By.xpath("//a[contains(@href, '" + name + "')]/ancestor::span[@class='blog-category-level']" + "//span[@class='blog-category-tools']"); WebElement category = getDriver().findElement(locator);
if (getDriver() instanceof JavascriptExecutor) { JavascriptExecutor js = (JavascriptExecutor) getDriver(); // instead of hovering, just show the toolbox js.executeScript("arguments[0].style.visibility='visible'", category); }
Alex
On 03/18/2010 02:53 AM, Alex Busenius wrote:
Hi all,
I'm writing integration tests for the patch fixing http://jira.xwiki.org/jira/browse/XABLOG-99. In particular, I want to test adding, renaming and deleting of blog categories from Blog/ManageCategories page.
My problem is that the "toolbox" with rename and delete buttons is only displayed on hover, and selenium complains that it cannot access invisible elements.
I tried to use RenderedWebElement.hover() as follows:
By locator = By.xpath("//a[contains(@href, \"" + name + "\")]/ancestor::span[@class='blog-category-level']"); RenderedWebElement category = (RenderedWebElement) getDriver().findElement(locator); category.hover();
but the n I get error "Unable to hover over element".
Does anybody knows how to show these delete buttons? I'm using FF 3.6 on Linux.
Thanks, Alex _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Jerome, On 03/19/2010 02:52 PM, Jerome Velociter wrote:
Hi Alex,
We could add a helper method for this situation in BasePage, with a signature like:
void makeElementVisible(By locator);
That would be nice, there are many places where control elements are hidden like this.
Do you know if their is an issue in their tracker for this ? If they have plans to support it in the future?
You mean to make elements visible? I don't think they will ever support that, they always say that selenium tries to emulate user behavior, and users can't just show invisible elements. There is no issue about hovering neither, but it looks like one month ago it was not yet implemented at all. Link to the discussion about hover: http://groups.google.com/group/selenium-developers/browse_thread/thread/3a88... Alex
Regards, Jerome
In case somebody is interested, I found a workaround on selenium mailing list. The trick is to execute some JavaScript that does what is needed, in my case just shows the element.
By locator = By.xpath("//a[contains(@href, '" + name + "')]/ancestor::span[@class='blog-category-level']" + "//span[@class='blog-category-tools']"); WebElement category = getDriver().findElement(locator);
if (getDriver() instanceof JavascriptExecutor) { JavascriptExecutor js = (JavascriptExecutor) getDriver(); // instead of hovering, just show the toolbox js.executeScript("arguments[0].style.visibility='visible'", category); }
Alex
On 03/18/2010 02:53 AM, Alex Busenius wrote:
Hi all,
I'm writing integration tests for the patch fixing http://jira.xwiki.org/jira/browse/XABLOG-99. In particular, I want to test adding, renaming and deleting of blog categories from Blog/ManageCategories page.
My problem is that the "toolbox" with rename and delete buttons is only displayed on hover, and selenium complains that it cannot access invisible elements.
I tried to use RenderedWebElement.hover() as follows:
By locator = By.xpath("//a[contains(@href, \"" + name + "\")]/ancestor::span[@class='blog-category-level']"); RenderedWebElement category = (RenderedWebElement) getDriver().findElement(locator); category.hover();
but the n I get error "Unable to hover over element".
Does anybody knows how to show these delete buttons? I'm using FF 3.6 on Linux.
Thanks, Alex _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Jerome,
On 03/19/2010 02:52 PM, Jerome Velociter wrote:
Hi Alex,
We could add a helper method for this situation in BasePage, with a signature like:
void makeElementVisible(By locator);
That would be nice, there are many places where control elements are hidden like this.
Please include it in the patch for XABLOG-99 if you need it.
Do you know if their is an issue in their tracker for this ? If they have plans to support it in the future?
You mean to make elements visible? I don't think they will ever support that, they always say that selenium tries to emulate user behavior, and users can't just show invisible elements.
There is no issue about hovering neither, but it looks like one month ago it was not yet implemented at all.
Yes that's what I meant. support for "moving cursor to point over an element".
Link to the discussion about hover: http://groups.google.com/group/selenium-developers/browse_thread/thread/3a88...
Thanks, Jerome.
Alex
Regards, Jerome
In case somebody is interested, I found a workaround on selenium mailing list. The trick is to execute some JavaScript that does what is needed, in my case just shows the element.
By locator = By.xpath("//a[contains(@href, '" + name + "')]/ancestor::span[@class='blog-category-level']" + "//span[@class='blog-category-tools']"); WebElement category = getDriver().findElement(locator);
if (getDriver() instanceof JavascriptExecutor) { JavascriptExecutor js = (JavascriptExecutor) getDriver(); // instead of hovering, just show the toolbox js.executeScript("arguments[0].style.visibility='visible'", category); }
Alex
On 03/18/2010 02:53 AM, Alex Busenius wrote:
Hi all,
I'm writing integration tests for the patch fixing http://jira.xwiki.org/jira/browse/XABLOG-99. In particular, I want to test adding, renaming and deleting of blog categories from Blog/ManageCategories page.
My problem is that the "toolbox" with rename and delete buttons is only displayed on hover, and selenium complains that it cannot access invisible elements.
I tried to use RenderedWebElement.hover() as follows:
By locator = By.xpath("//a[contains(@href, \"" + name + "\")]/ancestor::span[@class='blog-category-level']"); RenderedWebElement category = (RenderedWebElement) getDriver().findElement(locator); category.hover();
but the n I get error "Unable to hover over element".
Does anybody knows how to show these delete buttons? I'm using FF 3.6 on Linux.
Thanks, Alex _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Alex Busenius -
Jerome Velociter