第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

請(qǐng)老師回答一下

為什么只能啟動(dòng)Firefox瀏覽器 ?而連接不上百度呢?????????

正在回答

1 回答

package denglu;
/**
?* 實(shí)現(xiàn)了從百度搜索慕課網(wǎng)-打開慕課網(wǎng)
?*/
import static org.junit.Assert.*;

import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class shouxie {
?? ?// 添加驅(qū)動(dòng) 倒過來的jar包 FirefoxDriver指明要用火狐測(cè)試 如果要用ie的話用ieDriver
?? ?private WebDriver driver = new FirefoxDriver();
?? ?private String baseUrl;

?? ?// 用例執(zhí)行前的準(zhǔn)備1
?? ?@Before
?? ?public void setUp() throws Exception {

?? ??? ?// 設(shè)置要打開的網(wǎng)絡(luò)的路徑
?? ??? ?baseUrl = "https://www.baidu.com/";

?? ??? ?driver.get(baseUrl + "/");

?? ??? ?// 指定設(shè)置火狐的路徑 后面是火狐的安裝路徑 要不然可能會(huì)找不到
?? ??? ?System.setProperty("webdriver.girefox.bin", "D:\\firefox.exe");
?? ??? ?// 把瀏覽器窗口調(diào)整成最大化
?? ??? ?driver.manage().window().maximize();

?? ?}

?? ?// 用例執(zhí)行后3
?? ?@After
?? ?public void tearDown() throws Exception {

?? ??? ?// 關(guān)閉瀏覽器?
?? ??? ?Thread.sleep(5000);
?? ??? ? //driver.quit();
?? ?}

?? ?// 2
?? ?@Test
?? ?public void test() {
?? ??? ?// fail("Not yet implemented");
?? ??? ?// 下面的方法是根據(jù)id找到控件,讓后在。出控件的具體內(nèi)容 看是點(diǎn)擊控件 或者是輸入內(nèi)容
?? ??? ?// 第一部 找到搜索框 輸入內(nèi)容
?? ??? ?driver.findElement(By.id("kw")).sendKeys("慕課網(wǎng)");
?? ??? ?// 根據(jù)id的方式找到搜索按鈕 并ckick方法點(diǎn)擊
?? ??? ?driver.findElement(By.id("su")).click();
?? ??? ?driver.findElement(By.linkText("慕課網(wǎng)-程序員的夢(mèng)工廠")).click();

?? ??? ?driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

?? ?}

}

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

請(qǐng)老師回答一下

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)