小编Shr*_*K R的帖子

如何将鼠标悬停在硒上?

如何为元素添加悬停?考虑下面的代码:

package AutomationFramework;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.*;

import org.openqa.selenium.firefox.FirefoxDriver;

public class LoginPage {

    private static WebDriver driver = null;

    public static void main(String[] args) {

        // Create a new instance of the Firefox driver

        driver = new FirefoxDriver();

        //Put a Implicit wait

        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

        //Launch the Website

        driver.get("URL");

        // Find the element that's ID attribute is 'account'(My Account) 

       // driver.findElement(By.xpath("/html/body/table/tbody/tr[5]/td/table/tbody/tr/td[2]/form/table/tbody/tr[3]/td[2]/input")).click();

        // Enter Username on the element 

        driver.findElement(By.name("userName")).sendKeys("remote"); 

        // Find the element that's ID attribute is 'pwd' (Password)

        driver.findElement(By.name("password")).sendKeys("aaaaaa");

        // Now …
Run Code Online (Sandbox Code Playgroud)

java selenium hover selenium-webdriver

1
推荐指数
1
解决办法
5025
查看次数

标签 统计

hover ×1

java ×1

selenium ×1

selenium-webdriver ×1