We're in the process of setting up GUI Automation via Selenium.
I'm currently able to open the textItem editors in our listGrid via selenium.doubleClick(scLocator="IDE-generatd locator") and Add text to the existing cell values via selenium.type(scLocator="IDE-generated locator"). However, I haven't been able to find the same scLocator using (WebDriver)driver.findElement() by using an implementation similar to that which was said to be successful in the following thread.
http://groups.google.com/group/webdriver/browse_thread/thread/bbc35e6b7c863d96/4265d0674100c061
Should this work?
element = (WebDriver)driver.findElement(Sc.locator(editCellLocator));
Where;
String editCellLocator = "scLocator=//ListGrid[ID=\"isc_PromoEditorGridPanel_45_0\"]/editRowForm/item[name=sub_category]/element";
(example scLocator value, none are locatable via the Sc.locator() implementation)
and the Sc class is defined;
public class Sc {
public static By locator(final String locator) {
if (locator == null) {
throw new IllegalArgumentException("Cannot find elements with a null id attribute.");
}
return new By() {
@Override
public List<WebElement> findElements(SearchContext context) {
return Collections.<WebElement>emptyList();
}
@Override
public WebElement findElement(SearchContext context) {
JavascriptExecutor executor = (JavascriptExecutor) context;
WebElement we = (WebElement) executor.executeScript("return AutoTest.getElement(arguments[0]);",locator);
return (WebElement) we;
}
};
}
}
The WebDriverBacked selenium selenium.doubleClick() and .type() are configured to use AutoTest's locator;
selenium.addLocationStrategy("scLocator", "return inWindow.isc.AutoTest.getElement(locator);");
Ultimately I'm hoping to be able to open a menu from the context menu header via a context click via something like;
WebElement foo = driver.findElement(Sc.locator("scLocator=//ListGrid[ID=\"isc_PromoEditorGridPanel_45_0\"]/header[Class=Toolbar||scRole=toolbar]/headerButton[fieldName=pe_row_approval]/"));
Actions builder = new Actions(driver);
builder.contextClick(foo).perform();
We are using SmartGWT 2.5
I'm currently able to open the textItem editors in our listGrid via selenium.doubleClick(scLocator="IDE-generatd locator") and Add text to the existing cell values via selenium.type(scLocator="IDE-generated locator"). However, I haven't been able to find the same scLocator using (WebDriver)driver.findElement() by using an implementation similar to that which was said to be successful in the following thread.
http://groups.google.com/group/webdriver/browse_thread/thread/bbc35e6b7c863d96/4265d0674100c061
Should this work?
element = (WebDriver)driver.findElement(Sc.locator(editCellLocator));
Where;
String editCellLocator = "scLocator=//ListGrid[ID=\"isc_PromoEditorGridPanel_45_0\"]/editRowForm/item[name=sub_category]/element";
(example scLocator value, none are locatable via the Sc.locator() implementation)
and the Sc class is defined;
public class Sc {
public static By locator(final String locator) {
if (locator == null) {
throw new IllegalArgumentException("Cannot find elements with a null id attribute.");
}
return new By() {
@Override
public List<WebElement> findElements(SearchContext context) {
return Collections.<WebElement>emptyList();
}
@Override
public WebElement findElement(SearchContext context) {
JavascriptExecutor executor = (JavascriptExecutor) context;
WebElement we = (WebElement) executor.executeScript("return AutoTest.getElement(arguments[0]);",locator);
return (WebElement) we;
}
};
}
}
The WebDriverBacked selenium selenium.doubleClick() and .type() are configured to use AutoTest's locator;
selenium.addLocationStrategy("scLocator", "return inWindow.isc.AutoTest.getElement(locator);");
Ultimately I'm hoping to be able to open a menu from the context menu header via a context click via something like;
WebElement foo = driver.findElement(Sc.locator("scLocator=//ListGrid[ID=\"isc_PromoEditorGridPanel_45_0\"]/header[Class=Toolbar||scRole=toolbar]/headerButton[fieldName=pe_row_approval]/"));
Actions builder = new Actions(driver);
builder.contextClick(foo).perform();
We are using SmartGWT 2.5
Comment