lundi 18 mai 2020

Unlikely argument type for equals(): String seems to be unrelated to WebElement

try
    {
        if(drive.findElement(By.xpath("//*[@id=\"nav-logo\"]/a[2]")).isDisplayed()&&drive.findElement(By.xpath("//*[@id=\"nav-logo\"]/a[2]")).equals("Text))

        {
            System.out.println(filename+"="+"Valid account");
            uk1.write(filename+"="+"Valid account");
            uk1.newLine();
        }
    }
    catch(Exception e)
    {
            System.out.println(filename+"="+"Replace this account in tod file");
            uk1.write(filename+"="+"Replace this account in my file");
            uk1.newLine();
    }

How to overcome the above exception.*Is there any otherway check the two condition in if statement.This may cause my code to stop/skip the execution?.

If i likely to use nested if also i am getting the same error.

Aucun commentaire:

Enregistrer un commentaire