码迷,mamicode.com
首页 > 编程语言 > 详细

java工作复习——4大时间等待——强制等待(Thread.sleep(5000);)

时间:2020-04-22 13:23:35      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:rgs   ndk   click   dcs   read   时间   drive   row   form   

package jkcs;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;

public class jdcs 
{
    
    public static void main(String[] args) throws InterruptedException 
    {
         System.setProperty("webdriver.chrome.bin","?C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");    //设置安装路径,防止系统找不到
         
         WebDriver driver = new FirefoxDriver();        //初始化FireFox浏览器实例,并打开浏览器

         driver.manage().window().maximize();         //最大化窗口  
        
        
        
         driver.navigate().to("http://www.baidu.com"); 
        
         Thread.sleep(5000); 
        

        
         driver.findElement(By.id("kw")).sendKeys("china");        //文本框里输入
         
         Thread.sleep(5000); 
        
         
         
         Actions sj = new Actions(driver);
         
         sj.click(driver.findElement(By.id("su"))).perform();   //模拟鼠标左击
         Thread.sleep(8000);
        

         driver.quit();
    }
}

 

java工作复习——4大时间等待——强制等待(Thread.sleep(5000);)

标签:rgs   ndk   click   dcs   read   时间   drive   row   form   

原文地址:https://www.cnblogs.com/xiaobaibailongma/p/12751245.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!