Xin trợ giúp code Selenium

Mình có dòng lệnh Selenium đơn giản là chỉ mở trang google bằng IE11 bằng Selenium:

public class Main {

public static WebDriver driver_IE;
public RemoteWebDriver driver;

public static void main(String[] args) {
	
	// TODO Auto-generated method stub
	System.setProperty("webdriver.ie.driver","IEDriverServer_x64_3.0.0/IEDriverServer.exe");
	//DesiredCapabilities cap= DesiredCapabilities.internetExplorer();
	//cap.setCapability("marionette", true);
	driver_IE = new InternetExplorerDriver();
	driver_IE.get("https://www.google.com.vn/");
}
}

Nhưng nó cứ báo lỗi, các bạn hướng dẫn giúp mình fix lỗi này như thế nào

Started InternetExplorerDriver server (64-bit)
3.0.0.0
Listening on port 48917
Only local connections are allowed
Dec 27, 2016 11:11:14 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel’s Law holds true on the remote end
Dec 27, 2016 11:11:14 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Dec 27, 2016 11:11:14 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}], required capabilities = Capabilities [{}]
Build info: version: ‘3.0.1’, revision: ‘1969d75’, time: ‘2016-10-18 09:49:13 -0700’
System info: host: ‘W2VN-DINHHQ’, ip: ‘192.168.104.48’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_111’
Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
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:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:180)
at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:144)

3s khi search google, mong giúp giải quyết đc vấn đề của bạn.

This can work out of the box without the desired capability settings. Go to internet options>>Security, click on:'Reset all zones to default level and after that, ensure that the ‘Enable protected mode’ checkbox is ticked for all the four zones.

source: http://stackoverflow.com/questions/40172788/unable-to-create-new-remote-session

2 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?