所有子页面上的Selenium webdriver

时间:2017-07-20 18:19:19

标签: java selenium selenium-webdriver automation

好的,你可以在下面看到我的代码 代码打开一个chrome窗口然后我手动浏览到matematikfessor.dk 登录并打开一个东西然后我想填写matematikfessor.dk的任何子URL上的文本框,如https://www.matematikfessor.dk/exalpme/testing/#

JOptionPane.showMessageDialog(null, "Hello");
            System.setProperty("webdriver.chrome.driver", "C:\\Users\\danie\\Downloads\\chromedriver_win32/chromedriver.exe");
            WebDriver driver = new ChromeDriver();
            driver.manage().window().maximize();
            String url = driver.getCurrentUrl();
            driver.get(url);
            WebElement answer = driver.findElement(By.xpath("//input[@class='answerInput']"));
            WebElement answertest = driver.findElement(By.xpath("//input[@class='answerWrapper']"));
            answer.sendKeys("12");
            answertest.sendKeys("123");

0 个答案:

没有答案