I am facing issue while printing the size of list:
System.out.println("no of list", +list.size());
And the error is:
"the method println(int)" in the type printstream is not applicable for the arguments(string, int)
Here is my code:
package newpackage;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class TagNme_Locator {
public static void main(String[] args) {
System.setProperty("webdriver.ie.driver", "C:\\Program [enter image description here][1]Files\\selenium\\IEDriver\\IEDriverServer.exe");
WebDriver driver= new InternetExplorerDriver();
driver.get("https://www.facebook.com/");
List <WebElement> list= driver.findElements(By.tagName("div"));
System.out.println("no of list", +list.size());
for(int i = 0; i < list.size(); i++){
System.out.println(list.get(i).getText());
}
}
}
答案 0 :(得分:1)
As mentioned in the comments, you're using a comma instead of the needed concatenation operator, which is +
in Java. I'm not sure if the comma was intended, based on the +list.size()
, but you never know.
Errors mean a lot if you know how to interpret them, this one meaning that you can't use two arguments of type String
and int
with a method defined for an argument of int
.