【发布时间】:2018-09-03 22:37:19
【问题描述】:
我在打印列表大小时遇到问题:
System.out.println("no of list", +list.size());
错误是:
"the method println(int)" in the type printstream is not applicable for the arguments(string, int)
这是我的代码:
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());
}
}
}
【问题讨论】:
-
删除
,。 -
逗号表示您尝试输入两个参数,但它只接受一个。如上所述,删除逗号或在引号内移动。
-
谢谢.. 我是 selenium 和 java 的新手。感谢您的帮助。