相关疑难解决方法(0)

如何使用Selenium处理证书?

我正在使用Selenium来启动浏览器.如何处理要求浏览器接受证书的网页(URL)?

在Firefox中,我可能有一个这样的网站要求我接受这样的证书:

火狐

在Internet Explorer浏览器上,我可能会得到以下内容:

在此输入图像描述

在Google Chrome上:

谷歌浏览器

我再重复一个问题:当我使用Selenium(Python编程语言)启动浏览器(Internet Explorer,Firefox和Google Chrome)时,如何自动接受网站证书

python browser selenium python-3.x selenium-webdriver

59
推荐指数
5
解决办法
7万
查看次数

如何使用webdriver for Chrome和FireFox JAVA禁用cookie

我想用启动浏览器(FF,CHROME)进行禁用cookie测试,我试过这个:

           service =
                    new ChromeDriverService.Builder()
                            .usingDriverExecutable(new File("src/test/resources/chromedriver"))
                            .usingAnyFreePort().build();
            try {
                service.start();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

            DesiredCapabilities capabilities = DesiredCapabilities.chrome();
            capabilities.setCapability("disable-restore-session-state", true);
            driver = new ChromeDriver(service, capabilities);
Run Code Online (Sandbox Code Playgroud)

但它不起作用......

cookies selenium webdriver

13
推荐指数
1
解决办法
2万
查看次数

可以禁用firefox和chrome默认缓存吗?

我遇到了firefox缓存的问题,当我更改站点重定向时,firefox决定它需要缓存它.

关键是我不想创建一个测试编辑重定向的测试工作,但这个缓存阻止我这样做.

有没有办法禁用Firefox缓存?或者更好,但在需要时删除它?

注意:它不是cookie,而是实际的firefox缓存.

我正在使用webdriver C#版本.

firefox selenium webdriver

9
推荐指数
1
解决办法
1万
查看次数

如何在C#中为Chlenium Grid 2的Chrome添加配置文件首选项?

这是我为Chrome进行本地自动测试运行和TeamCity(CI)添加配置文件首选项的方法:

Capabilities = DesiredCapabilities.Chrome();

var chromeOptions = new ChromeOptionsWithPrefs();
chromeOptions.AddUserProfilePreference("download.default_directory", DownloadPath);
chromeOptions.AddUserProfilePreference("intl.accept_languages", "nl");
chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");

return new ChromeDriver(chromeDriverPath, chromeOptions);
Run Code Online (Sandbox Code Playgroud)

但是当我创建新的"RemoteWebDriver"时,我必须向它发送一个中心URL和"功能",这样我就可以将配置文件首选项发送到Firefox(到RemoteWebDriver):

var profile = new FirefoxProfile();

Capabilities = DesiredCapabilities.Firefox();

profile.SetPreference("browser.helperApps.alwaysAsk.force", false); 
profile.SetPreference("browser.download.useDownloadDir", true);
profile.SetPreference("browser.download.folderList", 2);
profile.SetPreference("browser.download.dir", DownloadPath);
profile.SetPreference("browser.helperApps.neverAsk.saveToDisk",
   "application/zip, application/octet-stream");

Capabilities.SetCapability(FirefoxDriver.ProfileCapabilityName, profile.ToBase64String());

return Capabilities;
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我,我需要像Chrome一样对Chrome做同样的事情.基本上我需要的是,我可以更改下载文件的默认路径.

c# selenium google-chrome selenium-grid2

3
推荐指数
1
解决办法
8444
查看次数