简体   繁体   English

使用 Safari 浏览器使用 Selenium 进行自动化测试

[英]Automation Testing with Selenium using Safari Browser

There is a problem when I'm executing selenium test scripts against the safari browser.当我针对 safari 浏览器执行 selenium 测试脚本时出现问题。

  • problem is: - I'm testing an application in which the front end is built from Angular.问题是: - 我正在测试一个应用程序,其中前端是从 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.有一个使用 Prime-Ng 的弹出式模态构建,当我使用 safari 浏览器运行我的测试脚本时它没有打开。 But the safe script worked for both Firefox and Chrome browsers.但是安全脚本适用于 Firefox 和 Chrome 浏览器。

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; 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; 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.使用最新的 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 .和角度:9.1.2检查生产变量的真值enviroment.production变量和enableProdMode()时,项目建成生产必须名为ng build --prod

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Windows 7的Safari上进行自动化测试 - Automation testing on safari on windows 7 结合使用Selenium和Java进行自动化测试 - Drag & Drop using Selenium with Java for automation testing 如何在 Java 中使用 Selenium 自动化测试登录 Gmail? 现在他们阻止登录测试浏览器驱动程序。 有办法吗? - How to Sign-in Gmail using Selenium automation testing in Java? Now that they block sign in from testing browser driver. Is there a way? 单击下载按钮后使用硒进行自动化测试以验证下载量 - Verifying a dowload after clicking on download button using selenium for automation testing 使用Firefox和Firefox浏览器进行自动化测试 - Automated testing using selenium with firefox browser 使用Selenium Webdriver支持浏览器兼容性测试 - Support Browser Compatibility Testing using Selenium Webdriver 使用NetBeans在Selenium上进行跨浏览器测试 - Cross browser testing on Selenium using NetBeans 无法使用Selenium(Java)自动化在firefox浏览器中右键单击 - Unable to right click in firefox browser using selenium (java) automation 使用Selenium和Chrome Dev Tools进行浏览器内存泄漏自动化 - Browser memory leak automation using Selenium and Chrome Dev Tools 在使用硒自动化时,单击Chrome浏览器的元素会出现问题吗? - Clicking an element for Chrome browser an issue when using selenium automation?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM