Selenium在Firefox中随机打开给定的应用程序URL

时间:2018-11-21 14:46:07

标签: selenium firefox automation profile

我正在启动Selenium测试(下面的启动器测试),为了连接到应用程序,应该选择一个证书,因此我使用了firefox -p,并且已经为所选配置文件保存了证书。 但是,当我运行测试时,它工作了2次。现在,浏览器无法再连接到URL。

系统: 壁虎:0.23.0 平台:Linux 的Firefox:63.0 硒:3.11.0

  System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE,"true");

        DesiredCapabilities capabilities = DesiredCapabilities.firefox();
       capabilities.setCapability("marionette", true);


        ProfilesIni profile = new ProfilesIni();


        FirefoxProfile profiles = profile.getProfile(profil);
        FirefoxOptions options = new FirefoxOptions();
        options.setProfile(profiles);
        options.addPreference("marionette.logging", "{level: trace}");
        options.addPreference("xpinstall.signatures.required", false);
        options.addPreference("browser.startup.homepage_override.mstone", "ignore");
        options.addPreference("geckodriver.logging", "{level: trace}")

    driver.manage().window().maximize();
    //driver.manage().timeouts().implicitlyWait(implicitwait, TimeUnit.SECONDS);
    this.wait = new WebDriverWait(driver, implicitwait);
    return driver;
}

套件类:

@BeforeClass
 public void initiate() throws Exception {

pool = Executors.newFixedThreadPool(thread);


final  String GECKODRIVER_PATH = "/home/geckodriver";


    if ( System.getProperty("webdriver.gecko.driver") == null)
        System.setProperty("webdriver.gecko.driver", GECKODRIVER_PATH);



@Test(priority = 1, testName = "test", description = "test")
public void testCase001() throws Exception {
testSuites = execute.getScenario(sec1, firefoxDriver);
pool.invokeAll(testSuites);                                }



@AfterClass(alwaysRun=true)
public void terminate(){

pool.shutdown();
 }

启动器测试:

@Profildetests(Profil = "Profile1")
public class  extends Suiteclass {

@Test(priority = 1, testName = "ddd", description = "dddd")
 public void test() throws InterruptedException, AWTException {                                                                            
   remoteWebDriver.get(ExecutionProperties.getInstance().getApplication());
      Thread.sleep(4000);
       firefoxCertificat certificat = new 
 firefoxCertificat(remoteWebDriver);
    Workcreation workcreation = new Workcreation(remoteWebDriver);
        ........}}

我不知道该怎么办

Stacktrace

org.openqa.selenium.WebDriverException: Reached error page: about:neterror?e=netTimeout&u=https%3A//10.114.2.119/dcfc=UTF-8&f=regular&d=Le%20serveur%20%C3%A0%20l%E2%80%99adresse%2010.114.2.119%20met%20trop%20de%20temps%20%C3%A0%20r%C3%A9pondre.
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
System info: host: 'teee', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-39-generic', java.version: '1.8.0_77'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 63.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 7154, moz:profile: /tmp/rust_mozprofile.zyf9Mi..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.15.0-39-generic, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 0ef4a7ea-b2a1-46bf-8c3d-084123976bd7
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:273)

0 个答案:

没有答案