Home > other >  Getting Warning for deprecation without using setCapabilities class
Getting Warning for deprecation without using setCapabilities class

Time:06-04

I am creating a Selenium testing framework. I have created my baseclass and am adding things now. It is at a basic stage but already when executing a test class I get Warnings that Im not following W3C syntax. I have tried to google the error and understand where I am not following it, but the articles i find only mention the deprecated setCapabilites. What am I doing wrong?

Console Log text:

ChromeDriver was started successfully.
May 29, 2022 2:21:12 P.M. org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected upstream dialect: W3C
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "chrome" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "chrome" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "networkConnectionEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "networkConnectionEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "platform" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "platform" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "javascriptEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "javascriptEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
INFO: Found exact CDP implementation for version 101
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "chrome" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "javascriptEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "networkConnectionEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "platform" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "networkConnectionEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "chrome" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "platform" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "javascriptEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "networkConnectionEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "chrome" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "platform" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "javascriptEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "networkConnectionEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "chrome" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "platform" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "javascriptEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "chrome" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "javascriptEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "networkConnectionEnabled" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/
May 29, 2022 2:21:12 P.M. org.openqa.selenium.W3CCapabilityKeysValidator validateCapability
WARNING: Support for Legacy Capabilities is deprecated; You are sending "platform" which is an invalid capability. Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/

My base class:

package resources;

import java.io.FileInputStream;
import java.io.IOException;
import java.time.Duration;
import java.util.Properties;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class base {

    public WebDriver driver;
    public Properties prop;

    public WebDriver initializeDriver() throws IOException {
        
        
        FileInputStream fis=new FileInputStream("D:\\Projects\\EclipseWorkspace\\E2EPrj\\src\\main\\java\\resources\\data.properties");
        prop = new Properties();
        
        prop.load(fis);
        String browserName = prop.getProperty("browser");
        
        if(browserName.equals("chrome"))
        {
            //execute in chromedriver
            ChromeOptions options = new ChromeOptions();
            options.addArguments("start-maximized");
            
            System.setProperty("webdriver.chrome.driver","D:\\Projects\\chromedriver.exe");
            driver = new ChromeDriver(options);
            
        }
        else if(browserName.equals("firefox"))
        {
            //execute in geckodriver
            System.setProperty("webdriver.chrome.driver","D:\\Projects\\geckodriver.exe");
            driver = new FirefoxDriver();
        }
        else if(browserName.equals("IE"))
        {
            //execute in IEdriver
            System.setProperty("webdriver.chrome.driver","D:\\Projects\\IEDriverServer.exe");
            driver = new InternetExplorerDriver();
        }
        
        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(3));
//      driver.manage().deleteAllCookies();
        
        return driver;
    }
    
//  public String getScreenShotPath(String testCaseName, WebDriver driver) throws IOException
//  {
//      TakesScreenshot ts=(TakesScreenshot) driver;
//      File source = ts.getScreenshotAs(OutputType.FILE);
//      String destinationFile = ".\\reports\\" testCaseName ".png";
//      FileUtils.copyFile(source, new File(destinationFile));
//      return destinationFile;
//  }
    
}

CodePudding user response:

That's look an issue for the newest Selenium version(4.2.0), Because its Logging warnings when non-W3C caps are being used (release notes)

and reported as a bug on Selenium Github Repo ISSUE 10711.

as diemol (SeleniumHQ core member) commented, a patch will be released soon.

In fact, issue is coming from (Chrome, Edge and Gecko) driver's side

when a session is created, driver's is returning non-W3C WebDriver caps

For now no need to worry about this warnings, the new Selenium release will ignore this warnings for ChromeDriver, EdgeWebDriver and GeckoDriver as you can see commit on Selenium repo until this issue is fixed from the WebDrivers side.

  • Issue for Chrome Driver reported HERE.
  • Issue for Edge Web Driver reported HERE.
  • Issue for Gecko Driver reported HERE.
  • Related