我在网页上有一个类,我正在尝试创建自动化测试,多次使用,无论如何都要在java中创建每个这样的列表,以便我以后可以使用它们?
public class SocketFactoryWithTimeout implements SocketFactory {
public Socket createSocket(String host, int port) throws IOException,
UnknownHostException
{
socket=new Socket();
int timeout = 60000;
socket.connect(new InetSocketAddress(host, port), timeout);
return socket;
}
public InputStream getInputStream(Socket socket) throws IOException
{
return socket.getInputStream();
}
public OutputStream getOutputStream(Socket socket) throws IOException
{
return socket.getOutputStream();
}
}
答案 0 :(得分:1)
使用findElements
(复数形式)
List<WebElement> elements = driver.findElements(By.className("node"));