英文:
how to handle this particular popup..this occurs only in firefox
问题
I am doing an automation learning project in this web site. https://www.shoppersstop.com/ and when using selenium Firefox browser, i got this particular popup.. i tried with firefox options to block it, but thats not working,, any help is appreciated...
System.setProperty("webdriver.gecko.driver", "src\test\resources\drivers\geckodriver.exe");
FirefoxOptions Options = new FirefoxOptions();
Options.addPreference("dom.disable_beforeunload", true);
driver = new FirefoxDriver(Options);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
英文:
I am doing an automation learning project in this web site. https://www.shoppersstop.com/ and when using selenium Firefox browser, i got this particular popup.. i tried with firefox options to block it, but thats not working,, any help is appreciated...
System.setProperty("webdriver.gecko.driver", "src\\test\\resources\\drivers\\geckodriver.exe");
FirefoxOptions Options = new FirefoxOptions();
Options.addPreference("dom.disable_beforeunload", true);
driver = new FirefoxDriver(Options);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);][1]][1]
答案1
得分: 1
你可以使用配置属性来禁用这个功能:
FirefoxOptions Options = new FirefoxOptions();
Options.addPreference("dom.disable_beforeunload", true);
final FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("geo.enabled", false);
profile.setPreference("geo.provider.use_corelocation", false);
profile.setPreference("geo.prompt.testing", false);
profile.setPreference("geo.prompt.testing.allow", false);
options.setProfile(profile);
driver = new FirefoxDriver(Options);
英文:
You can disable this with profile properties:
FirefoxOptions Options = new FirefoxOptions();
Options.addPreference("dom.disable_beforeunload", true);
final FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("geo.enabled", false);
profile.setPreference("geo.provider.use_corelocation", false);
profile.setPreference("geo.prompt.testing", false);
profile.setPreference("geo.prompt.testing.allow", false);
options.setProfile(profile);
driver = new FirefoxDriver(Options);
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论