Hi Friends,
This is the first time I am posting a question to this forum. I tried to include as many details as possible here.
I am using IntelliJ IDEA for selenium automation. I am trying to automate below test cases as follows.
- Login to ebay.in and search JBL Speakers.
- From ebay.in navigate to Simplilearn website and navigate back to ebay.in
I was using the method " driver.navigate().to(“Simplilearn”) ". The first use case got executed, but second use case of navigating from ebay.in to Simplilearn failed.
The program stops executing and throws an error message - Starting ChromeDriver 81.0.4044.138 (8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999}) on port 9252
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
I am using Windows 10 Home edition
Chrome browser Version 81.0.4044.138 (Official Build) (64-bit) and chrome driver 81.0.4044 IntelliJ IDEA 2020.1.1 community edition.
Below is the program I am trying to execute:
package com.Selenium_ICT_intellij;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ebaySearch {
WebDriver driver;
public void launchBrowser(){
System.setProperty("webdriver.chrome.driver", "C:Path to chromedriver.exe");
driver = new ChromeDriver();
driver.get("https://www.ebay.co.uk/");
}
public void searchProduct() throws InterruptedException {
Thread.sleep(2000);
driver.findElement(By.id("gh-ac")).sendKeys("JBL Speakers");
driver.findElement(By.id("gh-btn")).click();
Thread.sleep(2000);
driver.findElement(By.linkText("Deals")).click();
}
public void navigateUrl() throws InterruptedException {
Thread.sleep(2000);
driver.navigate().to("https://www.udemy.com/");
Thread.sleep(3000);
}
public static void main (String args[]) throws InterruptedException {
ebaySearch obj = new ebaySearch();
obj.launchBrowser();
obj.searchProduct();
obj.navigateUrl();
}
}
Screenshot of Error message: