1

I'm honestly not even sure what to do at this point I'm not getting any error logs in the console just the logger messages that I've put into the scripts.

When I get to the line of code where I create the Dashboard Constructor it terminates the test and declares it a failure, last logged message is always "About to start looking"

I even gutted the entire constructor(commented out all code, removed the driver parameter, and just put a print statement in it) before posting this question and when I called the print method within the class the script failed at the line where the creation of the constructor happened.

I don't understand what's going on I could be missing something very obvious. I get failure but I don't necessarily see a specific error message in the console either.

Here is the test case im attempting to run:

package com.symphio.testCases;
import java.util.concurrent.TimeUnit;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.symphio.pageObjects.Dashboard;
import com.symphio.pageObjects.loginSymphio;


public class TC_Dashboard_Search_002 extends BaseClass{

    
    @Test
    public void searchForTile() throws InterruptedException {
        
        logger.info("Connected to "+ baseURL);
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
                
        loginSymphio login = new loginSymphio(driver);
        //logs in
        login.setUserName(userName);
        logger.info("entered username");
        login.setPassWord(passWord);
        logger.info("entered password");
        login.pressSubmit();
        logger.info("button pressed");
        
        
        //searches for tile
        Thread.sleep(3000);


        logger.info("about to start looking");
        Dashboard dashboard = new Dashboard(driver);
        dashboard.mouseMover();
        logger.info("found Icon");
        dashboard.searchBarText(searchText);
        logger.info("input text");
        dashboard.tileClick();      
        logger.info("clicked");
                
    }
}

Here is my DashBoard pageObject

package com.symphio.pageObjects;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

public class Dashboard {
    WebDriver driver;

    public Dashboard(WebDriver driver) {
        this.driver = driver;
        PageFactory.initElements(driver, this);     
        
    } 
        
    @FindBy(className="search-container")
    WebElement searchImg;
    
    @FindBy(xpath="//input[@type='search']")
    WebElement searchText;
    
    @FindBy(xpath="//input[contains(@class,'mat-card'), and contains(@class, 'mat-focus-indicator'), and contains(@class, 'arrangement-card')]")
    WebElement tileBox;
    
    
    Actions actions = new Actions(driver);

    public void mouseMover() {
    Actions mouseOverOnElement = actions.moveToElement(searchImg);
    mouseOverOnElement.perform();
    
    }
    
    public void searchBarText(String text) {
        searchText.sendKeys(text);
                
    }
    
    public void tileClick() {
        tileBox.click();
        
        
    }
    
}

Console error:

console

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
getCritical
  • 341
  • 5
  • 15
  • Where is failure logs? If you running test from `testng.xml` file add the [verbose](http://seleniumworks.blogspot.com/2014/01/testng-verbose-attribute-selenium-users.html) attribute to it. – Mohamed Sulaimaan Sheriff Aug 16 '20 at 07:04
  • seems like after I added the verbose attribute I was able to see the actual error which was a null Pointer Exception error this was a big help because now I know what to start tackling – getCritical Aug 18 '20 at 16:18

2 Answers2

0

I think the problem here is that the Driver is not yet initialize in the DashBoard Class.

try to extend the DashBoard into BaseClass.

public class Dashboard extends BaseClass {
    
    public Dashboard(WebDriver driver) {
        this.driver = driver;
        PageFactory.initElements(driver, this);  

}   
        
  • I initialized the driver into the BaseClass and its extended into the test case not the page Object since the test case is using the driver functions. Im simply passing the driver into the constructor to allow use of the methods within the page Object. – getCritical Aug 17 '20 at 03:07
0

This error message...

...[WARNING]: Timed out connecting to Chrome, retrying...
...org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS

...implies that implies that the ChromeDriver / combo you are using is not the recent one as the current implementation of ChromeDriver follows WebDriver W3C specifications and initial logs reflects:

Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Nov 05, 2019 3:41:53 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C 

So your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=2.43
  • Release Notes of chromedriver=2.43 clearly mentions the following :

Supports Chrome v69-71

  • Possibly you are using the latest chrome=84.0
  • Release Notes of ChromeDriver v84.0 clearly mentions the following :

Supports Chrome version 84

So there is a clear mismatch between ChromeDriver v2.43 and the Chrome Browser v84.0


Solution

Ensure that:

  • JDK is upgraded to current levels JDK 8u251.
  • Selenium is upgraded to current levels Version 3.141.59.
  • ChromeDriver is updated to current ChromeDriver v84.0 level.
  • Chrome is updated to current Chrome Version 84.0 level. (as per ChromeDriver v84.0 release notes)
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • Take a System Reboot.
  • Execute your @Test as non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Reference

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thank you so much this is very helpful advice I will update you when I can but I will be sure to try these solutions. – getCritical Aug 17 '20 at 03:05