0

When I am trying to execute the script am not getting any error or exception but functionality is not working. can any one suggest me what is the reason for the same.

Selenium version: selenium-server-4.0.0-beta-2 version.
chrome supported version: Version 89.0.4389.114

Code

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import static org.openqa.selenium.support.locators.RelativeLocator.withTagName;

public class Relative Locator 
{
    public static void main(String[] args) throws Interrupted Exception
    {
        System.setProperty("webdriver.chrome.driver", "C:\\Users\\Amitava\\eclipse-workspace\\SeleniumForthEdition\\driver\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.rahulshettyacademy.com/angularpractice/");

        WebElement nameEditBox =driver.findElement(By.cssSelector("[name='name']"));    
        Thread.sleep(5000);
        System.out.println(driver.findElement(withTagName("label").above(nameEditBox)).getText());
        Thread.sleep(5000);
        WebElement email =driver.findElement(By.xpath("//*[contains(text(),'Email')]"));    
        Thread.sleep(8000);
        System.out.println("selenium-server-4.0.0-beta-2");
        driver.findElement(withTagName("input").below(email)).sendKeys("ami00@gmail.com");
    }

}

Console output

Starting ChromeDriver 89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294}) on port 10578
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1617949244.583][WARNING]: Timed out connecting to Chrome, retrying...
Apr 09, 2021 11:50:53 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Apr 09, 2021 11:50:55 AM org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
INFO: Found exact CDP implementation for version 89
Name
selenium-server-4.0.0-beta-2


 
JeffC
  • 22,180
  • 5
  • 32
  • 55

2 Answers2

0

Please use the below code where you initialize your chrome driver. Looks like it does not receive the incoming messages from web protocol.

System.setProperty("webdriver.chrome.whitelistedIps", "");
Sonali Das
  • 943
  • 1
  • 7
  • 24