Problem with WebWriver GWT TabPanel table

I am trying to create a WebDriver test for a GWT application that uses a TabPanel. Clicking on a tab works fine in the IDE (it uses the x-path to find the tab), however I can’t get a click on the tab working in the JUnit test.

All elements have debugID, including tabs (although the tab identifier does not work even in the IDE), and I inherit com.google.gwt.user.Debug . I tried to find the Xpath, which is the default IDE.

 genericElement.findElement(By.xpath("//div[@id='gwt-debug-mainTabPanel']/div[2]/div/div[6]/div/div") 

I tried the code described in the documentation

 genericElement.findElement(By.id("gwt-debug-mainTabPanel-bar-tab6") 

I also tried to execute moveToelement (since clickAt no longer supported) and click, but it crashes too (if I don't understand it). I would also like to avoid this as this seems like bad practice.

  Actions builder = new Actions(driver); genericElement = driver.findElement(By.id("gwt-debug-mainTabPanel")); Action action = builder.moveToElement(genericElement,400, 370).click().build(); action.perform(); 

java.lang.UnsupportedOperationException: transition to arbitrary X, Y coordinates is not supported.

I know that GWT and Webdriver do not get along too well - but I feel this will have a solution. Can anyone offer any help - did anyone run a Webdriver working test in which they click a tab in the GWT TabPanel?

EDIT

I managed to find the node using Firebug and xpath locators (you can add / .. and move to the parent gwt-TabLayoutPanelTabInner or add /../ .. to translate to grandparent gwt-TabLayoutPanelTabInner, and this should still work - it works in the IDE)

 genericElement = driver.findElement(By.xpath("//div[contains(@class,'gwt-HTML') and contains(text(),'Users')]")); 

However, not clicking does not change to the desired tab - it seems to be a known problem (probably you do not need moveToElement either, and click (genericElement) - hust, giving it a chance)

 Actions builder = new Actions(driver); builder.moveToElement(genericElement).click(genericElement).build().perform(); 

See section 3 .... It's fun :)

+6
source share

Source: https://habr.com/ru/post/924766/


All Articles