Reputation: 81
I am new to Selenium and I programmed a basic robot in Python to play around. The first lines of code are just starting the web browser:
browser = webdriver.Chrome(ChromeDriverManager().install())
action = ActionChains(browser)
which works fine and allowed me to complete and test the rest of the robot, which logs into an account and downloads a document.
Then I changed to Java (the final language I need) and repeated the programming, which turned out to be pretty straightforward. The initial commands are:
System.setProperty("webdriver.chrome.driver", "C://Users/Pablo/Downloads/chromedriver.exe");
WebDriver driver = new ChromeDriver();
The code is fine for the IDE (Intellij), but when executing I get the error
Starting ChromeDriver 98.0.4758.102 (273bf7ac8c909cde36982d27f66f3c70846a3718-refs/branch-heads/4758@{#1151}) on port 51171 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully. Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Any clues about where the error may come from? My version of Chrome is the same as the driver's (98.0.4758.102). Other details:
Build info: version: '4.1.2', revision: '9a5a329c5a' System info: host: 'XXXX', ip: 'xxx.xxx.xx.x', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.2' Driver info: org.openqa.selenium.chrome.ChromeDriver
Thanks
Upvotes: 1
Views: 10632
Reputation: 81
I identified the problem, a very simple question for someone familiar with Maven (not me) and a not-so-easy one: Selenium was not properly included in the pom file, and windows defender was blocking the execution of the driver without informing about it. For the second one, it is necessary to exclude the driver from Window's security.
Upvotes: 1