微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

尝试将sendkey与selnium一起使用以完成表格

如何解决尝试将sendkey与selnium一起使用以完成表格

我对硒很陌生,使用sendkeys根本无法完成我的任务。

这是我的完整代码

package rough;

import java.util.List;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.support.ui.ExpectedConditions;

import org.openqa.selenium.support.ui.webdriverwait;

public class LookUpFieldTest {

    public static void main(String[] args) throws InterruptedException {

    System.setProperty("webdriver.gecko.driver",System.getProperty("user.dir") + "\\src\\test\\resources\\executables\\geckodriver.exe");

    WebDriver driver = new FirefoxDriver();

    driver.get("http://www.expedia.co.uk");

    Thread.sleep(3000);

    driver.findElement(By.xpath("//*[@id='uitk-tabs-button-container']/li[2]/a/span")).click();

    WebElement From = driver.findElement(By.xpath("//*[@id=\"location-field-leg1-origin-menu\"]/div[1]/button"));

    Thread.sleep(3000);

    From.sendKeys("London (LHR - Heathrow)");

    }
}

任何有关完成此操作的帮助都将被接受

谢谢 阿贾伊

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。