0

在以下程序中,第二个和第三个导入语句因以下语句而出错 - 包 org.openqa.selenium 可以从多个模块访问:client.combined、com.google.common。

以下是我添加到模块路径的 jar 文件。

模块路径中包含的 Jar 文件

有错误的程序

编译后

该程序使用 jdk 9 和氧气成功运行。但它现在失败了。请让我知道我可以做哪些更正以在我的项目中使用 webdriver。

提前致谢。

package javaExamples;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;



public class FirstTrial {
        WebDriver driver;   
        JavascriptExecutor jse;

        public void invokeBrowser() {

            try {
                System.setProperty("webdriver.chrome.driver",
                        "C:\\Selenium\\chromedriver_win32_2018_april\\chromedriver.exe");
                driver = new ChromeDriver();
                driver.manage().deleteAllCookies();
                driver.manage().window().maximize();
                driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);// allows system to wait max 30 secs if it
                                                                                // completes before its fine
                driver.get("http://www.edureka.co");
                searchBrowser();
            } catch (Exception e) {

                e.printStackTrace();
            }
        }

        public void searchBrowser() {
            driver.findElement(By.id("homeSearchBar")).sendKeys("java");
            // Thread.sleep(2000);//allows to wait for 2 secs. This is
explicit wait. System           // must sleep for 2 secs
            driver.findElement(By.id("homeSearchBarIcon")).click();

            jse = (JavascriptExecutor) driver;
            jse.executeScript("scroll(0,600)");

            driver.findElement(By.xpath("//label[contains(text(),'Weekend')]")).click();

        }

        public static void main(String[] args) {

            FirstTrial myobj = new FirstTrial();
            myobj.invokeBrowser();
        }

    }
4

0 回答 0