简体   繁体   中英

Automation Testing with Selenium using Safari Browser

There is a problem when I'm executing selenium test scripts against the safari browser.

  • problem is: - I'm testing an application in which the front end is built from Angular. There is a popup modal build using Prime-Ng and it is not opening when I'm running my test scripts with the safari browser. But the safe script worked for both Firefox and Chrome browsers.

This is My code: -

@Test(priority = 24)
public void testExitPopUp()throws Exception{
    try {
        gp.linktoExitgdpr.click();
       // gp.linktoExitgdpr.sendKeys(Keys.RETURN);
        logger.info("Exit Link Is Selected");
        Thread.sleep(4000);
        if (gp.exirtPopUpPane.isDisplayed()) {
            logger.info("Pop up Window is Displayed");
            Assert.assertTrue(true);
        } else {
            logger.info("Pop up Window is not Displayed");
            captureScreen(driver, "PopUPError");
            Assert.fail();
        }
    }catch (Exception e){
        logger.info("Missing Elements (Exception)");
        captureScreen(driver, "exceptionmissingelemnts");
        Assert.fail();
    }
}

Note: - here all the elements are called from another class. The following code shows how I fetched those Elements.

linktoExitgdpr - @FindBy(xpath = "/html/body/app-root/app-survey-layout/app-survey/app-survey-gdpr/div[1]/div/div[3]/div/div/div/div[3]/div[3]/a") @CacheLookup public WebElement linktoExitgdpr;

exirtPopUpPane - @FindBy(xpath = "/html/body/app-root/app-survey-layout/app-survey/app-survey-gdpr/div[2]/p-toast/div/p-toastitem/div") @CacheLookup public WebElement exirtPopUpPane;

Using the latest PrimeNG 9.0.6. and Angular: 9.1.2 check that the production variable has a true value in the enviroment.production variable and the enableProdMode() must be called when the project is built for production ng build --prod .

if (environment.production) { enableProdMode(); }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM