зеленый

ой тестовый класс со всеми строками кода. Я думаю, что проблема в xpath из-за того, что он не может найти элементы.

package practice;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class selPractice {

public static void main(String[] args) throws InterruptedException
{
    String key="webdriver.chrome.driver";
    String value="./software/chromedriver.exe";
    System.setProperty(key, value);
    WebDriver driver=new ChromeDriver();
    driver.get("https://www.google.com");
    //to automate auto suggestion 

driver.findElement(By.xpath("//input[@title='Search']")).sendKeys("motogp");
List<WebElement>motolist=driver.findElements(By.xpath("//ul[@role='listbox]
//li/descendant::div[@class='sbl1']"));
    Thread.sleep(2000);

    int count=motolist.size();
    System.out.println(count);
    for(WebElement list:motolist)
    {
        String text=list.getText();
        System.out.println(text);
    }
}
}

Ответы на вопрос(1)

Ваш ответ на вопрос