Unable to Resolve error for asserttrue and assertfalse

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to Resolve error for asserttrue and assertfalse

santuaili
This post was updated on .
I always end up getting the below errors

1. The method assertTrue(boolean) in the type Assert is not applicable for the arguments
         (WebElement)
2. The method assertFalse(boolean) in the type Assert is not applicable for the arguments
         (WebElement)

Please find my code as below:

package mypackage;

import org.openqa.selenium.By;
import org.testng.Assert;
import org.testng.annotations.Test;

@Test
public class WebDriverClass extends TestNGTest {

	public void mainProgram () {
		driver.get("http://www.wikipedia.org/");
		driver.findElement(By.id("searchInput")).sendKeys("Selenium Software");
		driver.findElement(By.name("go")).click();
		driver.findElement(By.cssSelector(".mw-search-results li:nth-child(1) a")).click();
		Assert.assertFalse(driver.findElement(By.cssSelector("img[src='//upload.wikimedia.org/wikipedia/en/5/5c/Seleniumlogo.png']"))).isDisplayed();
		
	
}
}


I am stuck at this point from two days.

Kindly help.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Unable to Resolve error for asserttrue and assertfalse

softwaretestingforum
Administrator
focus on this line, does it ring any bell?

		Assert.assertFalse(driver.findElement(By.cssSelector("img[src='//upload.wikimedia.org/wikipedia/en/5/5c/Seleniumlogo.png']"))).isDisplayed();
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Unable to Resolve error for asserttrue and assertfalse

santuaili
Yes, it rings bell.

There would be a suggestion to change assertTrue to assertFalse and vice versa but doing that would not solve the problem. Thanks
Santhosh


On Sat, Nov 9, 2013 at 12:54 AM, softwaretestingforum [via Manual and Automated Testing] <[hidden email]> wrote:
focus on this line, does it ring any bell?

		Assert.assertFalse(driver.findElement(By.cssSelector("img[src='//upload.wikimedia.org/wikipedia/en/5/5c/Seleniumlogo.png']"))).isDisplayed();



To unsubscribe from Unable to Resolve error for asserttrue and assertfalse, click here.
NAML



--
Warm Regards

Santhosh

"If fate would mean you to lose, give it a tough fight;"
Reply | Threaded
Open this post in threaded view
|

Re: Unable to Resolve error for asserttrue and assertfalse

softwaretestingforum
Administrator
No you are not thinking in right direction, look at the syntax of method...
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Unable to Resolve error for asserttrue and assertfalse

santuaili
Thanks!!




On Sat, Nov 9, 2013 at 6:12 PM, softwaretestingforum [via Manual and Automated Testing] <[hidden email]> wrote:
No you are not thinking in right direction, look at the syntax of method...


To unsubscribe from Unable to Resolve error for asserttrue and assertfalse, click here.
NAML



--
Warm Regards

Santhosh

"If fate would mean you to lose, give it a tough fight;"