【发布时间】:2020-01-02 18:53:57
【问题描述】:
我正在使用 Selenium 库解析网站 "https://www.diretta.it"。
当我再次单击后尝试单击链接时,没有结果。
这是代码:
public static void main(String[] args)
{
String url = "https://www.diretta.it/serie-a-2016-2017/";
// System Property for Chrome Driver
System.setProperty("webdriver.chrome.driver","C:\\..\\chromedriver_win32\\chromedriver.exe");
// Instantiate a ChromeDriver class.
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get(url);
driver.findElement(By.xpath("//a[@href='/serie-a-2016-2017/risultati/']")).click();
try
{
Thread.sleep(3000); // 3 secondi
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
这部分代码好像没有执行过
WebElement element = driver.findElement(By.xpath("//a[@class='event__more event__more--static']"));
Actions actions = new Actions(driver);
actions.moveToElement(element).click().build().perform();
}
这是我要点击的链接:
【问题讨论】: