Selenium 3.0 Firefx Driver fails with org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session

前端 未结 7 2057
渐次进展
渐次进展 2020-12-29 11:02

Selenium 3.0 Firefx Driver fails with org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session.

System.setProperty(\"webdriver.gec         


        
相关标签:
7条回答
  • 2020-12-29 11:17

    This worked (linux mint, opensuse thumbleweed, win7) with

    libraryDependencies += "org.seleniumhq.selenium" % "selenium-firefox-driver" % "3.0.1"

    geckodriver.exe -V geckodriver 0.13.0

    if (System.getProperty("os.name").toLowerCase().contains("linux")) {
      println("загружены настройки os.name=linux")
      System.setProperty("webdriver.chrome.driver", "bin/chromedriver")
      System.setProperty("webdriver.gecko.driver", "bin/geckodriver")
    
    }else{
      System.setProperty("webdriver.chrome.driver", "bin\\chromedriver.exe")
      System.setProperty("webdriver.gecko.driver", "bin\\geckodriver.exe")
      System.setProperty("webdriver.ie.driver", "bin\\IEDriverServer.exe")
      System.setProperty("webdriver.edge.driver", "C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe")
      System.setProperty("webdriver.opera.driver", "c:\\XXX\\operadriver.exe")
    
      System.setProperty("webdriver.opera.path","""C:\\Users\\user\\AppData\\Local\\Programs\\Opera""")
      System.setProperty("webdriver.opera.binary","""C:\\Users\\user\\AppData\\Local\\Programs\\Opera\\launcher.exe""")
      //
    }
    

    ...

          case
            "firefox" => {
            println(" подгружаем Веб-драйвер: geckodriver")
            //iniprofile = new ProfilesIni()
            //ffprofile = iniprofile.getProfile("default")
            dc = DesiredCapabilities.firefox()
            dc.setCapability("gecko", true) // как выйдет драйвер, так и установить
    //        dc.setCapability(FirefoxDriver.PROFILE, ffprofile); //FirefoxDriver.PROFILE = “firefox_profile”;
            remote = new FirefoxDriver(dc)
          }
    

    but, for Remotewebdriver-connection if previous session failed,cancelled or aborted we get error:

    [info] XXXX.E011_WebDB6292 *** ABORTED ***
    [info]   org.openqa.selenium.SessionNotCreatedException: Session is already started (WARNING: The server did not provide any stacktrace information)
    [info] Command duration or timeout: 0 milliseconds
    [info] Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
    [info] System info: host: 'XXXX', ip: '172.16.4.125', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_11'
    [info] Driver info: driver.version: RemoteWebDriver
    [info]   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    
    0 讨论(0)
  • 2020-12-29 11:25

    I had the same problem and fixed it with this. It seems it could not find the firefox binary

    capabilities.setCapability("firefox_binary","C:\\Program Files\\Mozilla Firefox\\firefox.exe");
    
    0 讨论(0)
  • 2020-12-29 11:26

    I ran into the same problem today, and it appears that not being admin on my laptop is actually an issue. To resolve it

    • Install in a non admin way Firefox (just need to click on no when Windows ask for privilege elevation)

    • Use the exe path (for my system something like C:\\Users\\MyUserName\\AppData\\Local\\MozillaFirefox\\firefox.exe).

      It actually solved the issue.

    0 讨论(0)
  • 2020-12-29 11:31

    this issue is solved with geckodriver 0.15 and selenium 3.3 version.

    0 讨论(0)
  • 2020-12-29 11:37

    You need to download geckodriver. And then set

    System.setProperty("webdriver.gecko.driver", "path\\to\\geckodriver.exe")
    

    Check this link.

    0 讨论(0)
  • 2020-12-29 11:40

    Same problem here. It was solved opening Eclipse/Netbeans with admin privileges.

    0 讨论(0)
提交回复
热议问题