ShaftHQ / SHAFT_ENGINE

SHAFT is a unified test automation engine for web, mobile, API, CLI, database, and desktop e2e testing. Powered by best-in-class frameworks, SHAFT provides a wizard-like syntax to drive your automation efficiently, maximize your ROI, and minimize your learning curve with no limitations! Stop reinventing the wheel! Upgrade now!
https://shafthq.github.io/
MIT License
335 stars 129 forks source link

Radio buttons and drop down lists cause [checkForElementVisibility] failed error but other elements are fine (in a specific website) #115

Closed ShorouqElrakhawy closed 4 years ago

ShorouqElrakhawy commented 4 years ago

Error: Element Action [checkForElementVisibility] failed. With the following test data [unique element matching this locator "By.id: days" is not visible.].

I'm not sure it's a bug or not but in a specific website "http://automationpractice.com/" I get this error while locating radio button or dropdown list (despite of they are visible) but text boxes or buttons are fine I'm over 3 hours investigating and I couldn't figure out what's wrong

Allure Report generatedReport_20200522-194656.zip

Sample TC public class test { public WebDriver driver; Faker fakeData = new Faker();

private By mrTitle = By.id("id_gender1");
private By days= By.id("days");
private By createAccountBtn = By.id("SubmitCreate");
private By emailCreateField = By.id("email_create");
private By firstName= By.id("customer_firstname");

@Test
public void verify() {
enterEmailAndClickCreateAccountBtn( fakeData.internet().emailAddress());
ElementActions.click(driver, mrTitle);
ElementActions.type(driver, firstName, fakeData.name().firstName());
ElementActions.select(driver, days, "3");
}
public void enterEmailAndClickCreateAccountBtn(String email) {
ElementActions.type(driver, emailCreateField, email);
ElementActions.click(driver, createAccountBtn);
}

@BeforeClass
public void beforeClass() {
driver = BrowserFactory.getBrowser();
BrowserActions.navigateToURL(driver, "http://automationpractice.com/index.php?controller=authentication");
}

}

MohabMohie commented 4 years ago

It looks like the select element is wrapped by a div [id="uniform-days"]... and hence the select element is not actually visible.

I recommend that you either interact with the visible element, or disable this optional flag to force interacting with the hidden elements.

image