저는 셀레늄 항아리 (셀레늄 - 서버 - 독립 실행 형 - 3.3.1)와 파이어 폭스 43.0.4를 사용하고 있습니다. 이클립스 버전 : Mars.2 릴리스 (4.5.2)새 selenium 웹 드라이버와 Firefox에서 오류가 발생했습니다.
나는 다음 코드
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class Links_Count_List {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","C:\\Users\\daniel\\Desktop\\Selenium\\geckodriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
//WebDriver driver = new MarionetteDriver(capabilities);
WebDriver driver=new FirefoxDriver();
driver.get("http://newtours.demoaut.com/");
WebElement link=driver.findElement(By.linkText("Home"));
System.out.println(link.getText());
//link.click();
List<WebElement> allLInks=driver.findElements(By.tagName("a"));
System.out.println("Total number of links are "+allLInks.size());
for(int i=0;i<allLInks.size();i++){
System.out.println(allLInks.get(i).getText());
}
}
}
나는 다음과 같은 오류를 받고 있어요를 실행합니다. 나는 도움을 청할 누군가를 요구한다.
콘솔
1492082184399 geckodriver INFO Listening on 127.0.0.1:10506
1492082185052 mozprofile::profile INFO Using profile path C:\Users\daniel\AppData\Local\Temp\rust_mozprofile.opDtseG9ymZk
1492082185054 geckodriver::marionette INFO Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args []
1492082185062 geckodriver::marionette INFO Connecting to Marionette on localhost:59371
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}], required capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}]
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'INFONOVUM-39', ip: '192.168.10.66', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_112'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:121)
at Links_Check.Links_Count_List.main(Links_Count_List.java:18)
위의 문제로 도와주세요 –