selenium打開(kāi)ie測(cè)試小實(shí)例

package mqTest;

網(wǎng)站建設(shè)哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、微信小程序、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了竹溪免費(fèi)建站歡迎大家使用!

import java.io.File;

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.ie.InternetExplorerDriver;

import org.openqa.selenium.remote.DesiredCapabilities;

public class testSelenium1 {

public testSelenium1() {

// TODO Auto-generated constructor stub

}

public static void main(String[] args) {

// TODO Auto-generated method stub

//WebDriver driver=new FirefoxDriver();

File file = new File("F:/IEDriverServer.exe");  

System.setProperty("webdriver.ie.driver", file.getAbsolutePath()); 

DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();

ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);

WebDriver driver=new InternetExplorerDriver(ieCapabilities);

driver.get("https://www.baidu.com");

//WebElement loginLink=driver.findElement(By.partialLinkText("登"));

//loginLink.click();

/*頁(yè)面代碼

* <input id="kw" name="wd" class="s_ipt" value="" maxlength="255" autocomplete="off"></span><span class="bg s_btn_wr"><input type="submit" id="su" value="百度一下" class="bg s_btn">

*/

//用id

WebElement baiduTextBox = driver.findElement(By.id("kw"));

baiduTextBox.sendKeys("selenium");

WebElement button=driver.findElement(By.id("su"));

button.click();

}

}

當(dāng)前題目:selenium打開(kāi)ie測(cè)試小實(shí)例
URL地址:http://bm7419.com/article34/jdgdpe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、服務(wù)器托管、網(wǎng)站設(shè)計(jì)公司、網(wǎng)站維護(hù)虛擬主機(jī)、靜態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

微信小程序開(kāi)發(fā)