currently im developing a relativ small GWT-Application and I'm testing the GUI with Selenium. Everything works fine but while I was writing my tests a question popped up in my head:
On my DummyPage I do the following:
public class DummyPage {
@FindBy(id = ID_SEARCH_BTN)
private WebElement btnSearch;
@FindBy(id = ID_CANCEL_BTN_CLEAR)
private WebElement btnClear;
...
public DummyPage() {
eventFiringDriver = DriverFactory.getInstance().getEventFiringDriver();
PageFactory.initElements(eventFiringDriver, this);
WebDriverWait webDriverWait = new WebDriverWait(eventFiringDriver, 20);
wait = webDriverWait.ignoring(StaleElementReferenceException.class);
}
In my Application if the User clicks on a Button a custom dialogBox is shown. This DialogBox is build in the clickHandler of the Button so it doesn't exist on the page?! I gave the Button on my custom DialogBox an ID to locate it on my TestPage.
My Question is if I try to Find the Button on the DialogBox by:
@FindBy(id = DIALOGBOX_YES_BTN)
private WebElement dialogBoxYesBtn;
Will the Object be null, or will the WebElement be fetched when its createt? Is Selenium looping over the FindBy Annotations and tries to resolve them?
At the moment I have a test where I click the first button and then in the same method I try to find the DialogBoxButton with its ID - its working but it would be nice if I could locale all WebElements at the top of the page Object.
Thanks in advance for any Help
Aucun commentaire:
Enregistrer un commentaire