国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

13.4web自動化測試(Selenium3+Java)

這篇具有很好參考價值的文章主要介紹了13.4web自動化測試(Selenium3+Java)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

一.定義

?用來做web自動化測試的框架.

二.特點

1.支持各種瀏覽器.

2.支持各種平臺(操作系統(tǒng)).

3.支持各種編程語言.

4.有豐富的api.

三.工作原理

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

四.搭環(huán)境

1.對照Chrome瀏覽器版本號,下載ChromeDriver,配置環(huán)境變量,我直接把.exe文件放在了jdk安裝路徑的bin文件夾下了(jdk配置了環(huán)境變量).

2.創(chuàng)建mavem項目,在pom.xml文件中引入Selenium依賴.

<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.7.2</version>
</dependency>

3.創(chuàng)建啟動類,用百度進行測試.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class Main {
    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        WebDriver webDriver = new ChromeDriver(options);
        webDriver.get("https://www.baidu.com");
    }
}

如果正常運行,則環(huán)境搭配好了.

五.css選擇器

1.id選擇器: #id

2.類選擇器: .class

3.標簽選擇器: 標簽

4.后代選擇器: 父級選擇器, 子級選擇器.

注意:兩種選擇器,建議使用CSS選擇器,因為效率高.

六.Xpath選擇器

1.絕對路徑: /html/......(效率低,不常用).

2.相對路徑: //......

a.相對路徑+索引

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

//form/span[1]/input

注意: 數(shù)組下標從1開始.

b.相對路徑+屬性值

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

//input[@class="s_ipt"]

c.相對路徑+通配符

//*[@*="s_ipt"]

d.相對路徑+文本匹配

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

?//a[text()="新聞"]

七.WebDriver的常用方法

1.click: 點擊.

2.sendKeys: 在對象上模擬鍵盤輸入.

3.clear: 清除對象輸入的文本內(nèi)容.

4.(不推薦使用)submit: 提交,和click作用一樣,但是有弊端,如果點擊的元素放在非form標簽中,此時submit會報錯(比如超鏈接(a標簽)).

5.text: 用于獲取元素的文本信息.

6.getAttribute: 獲取屬性值.

以上所有內(nèi)容的代碼練習

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.util.List;

import static java.lang.Thread.sleep;

public class Main {
    public static void main(String[] args) throws InterruptedException {
        // 測試是否通過的標致
        boolean flag = false;
        ChromeOptions options = new ChromeOptions();
        //允許所有請求
        options.addArguments("--remote-allow-origins=*");
        WebDriver webDriver = new ChromeDriver(options);
        // 1.打開百度首頁
        webDriver.get("https://www.baidu.com/");
        String title = webDriver.getTitle();
        String url = webDriver.getCurrentUrl();
        if (url.equals("https://www.baidu.com/") && title.equals("百度一下,你就知道")) {
            System.out.println("title和url正確");
        } else {
            System.out.println("title和url不正確");
        }
        // 2.兩種定位元素的方式: 1.cssSelector 2.Xpath
        // 使用瀏覽器,按F12,選中要測試的位置,在代碼中拷貝.
        // 找到百度搜索輸入框
        // 第一種: cssSelector
        WebElement element =  webDriver.findElement(By.cssSelector("#kw"));
        // 第二種: Xpath
        //WebElement Element = webDriver.findElement(By.xpath("http://*[@id=\"kw\"]"));
        // 3.輸入信息
        element.sendKeys("別克君越艾維亞");
        // 4.找到百度一下按鈕
        // 5.點擊按鈕
        webDriver.findElement(By.cssSelector("#su")).click();
        sleep(2000);
        // 6.校驗
        List<WebElement> elements = webDriver.findElements(By.cssSelector("a"));
        for (int i = 0; i < elements.size(); ++i) {
            if(elements.get(i).getText().contains("別克君越") || elements.get(i).getText().contains("艾維亞")) {
                System.out.println("測試通過");
                flag = true;
                break;
            }
        }
        if (!flag) {
            System.out.println("測試不通過");
        }
        // 清空輸入框
        element.clear();
        sleep(1500);
        // 在輸入框中重新輸入內(nèi)容
        element.sendKeys("別克威朗");
        webDriver.findElement(By.cssSelector("#su")).submit();
        // 獲取屬性值:百度一下
        System.out.println(webDriver.findElement(By.cssSelector("#su")).getAttribute("value"));
    }
}

八.等待

1.強制等待(sleep): 一直等待到規(guī)定時間.

2.智能等待:?設置的等待時間是最長的等待時間,如果完成了任務,會停止.

a.隱式等待(webDriver.manage().timeouts().implicitlyWait())

b.顯示等待: 指定某個任務進行等待.

區(qū)別: 隱式等待是等待頁面上所有因素加載進來,如果規(guī)定時間內(nèi)沒有加載進來,就會報錯.而顯示等待并不關心是否加載進來所有的元素,只要在規(guī)定時間內(nèi),在所有被加載進來的元素中包含指定的元素,就不會報錯.

3.代碼練習

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;


public class Main2 {
    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接百度
        driver.get("https://www.baidu.com/");
        // 判斷元素是否可以被點擊

        // 隱式等待
//        driver.manage().timeouts().implicitlyWait(Duration.ofDays(5));

        // 顯示等待
        WebDriverWait wait = new WebDriverWait(driver, Duration.ofMillis(3000));
        wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("#bottom_layer > div > p:nth-child(7) > a")));
    }
}

九.瀏覽器操作

1.后退: webdriver.navigate().back();

2.刷新:?webdriver.navigate().refresh();

3.前進:?webdriver.navigate().forward();

4.滾動條操作:?使用js腳本

劃到最底端:?

((JavascriptExecutor)driver).executeScript("document.documentElement.scrollTop=10000");

5.最大化:?driver.manage().window().maximize();

6.全屏:?driver.manage().window().fullscreen();

7.設置長寬:?driver.manage().window().setSize(new Dimension(600, 800));

8.代碼

import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import static java.lang.Thread.sleep;

public class Main3 {
    public static void main(String[] args) throws InterruptedException {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接百度
        driver.get("https://www.baidu.com/");
        driver.findElement(By.cssSelector("#kw")).sendKeys("君越艾維亞");
        driver.findElement(By.cssSelector("#su")).click();
        sleep(1500);
        // 回退
        driver.navigate().back();
        sleep(1500);
        // 刷新
        driver.navigate().refresh();
        sleep(1500);
        // 前進
        driver.navigate().forward();
        sleep(1500);
        // 滾動,使用js腳本
        // 劃到最底端
        ((JavascriptExecutor)driver).executeScript("document.documentElement.scrollTop=10000");
        sleep(1500);
        // 最大化
        driver.manage().window().maximize();
        sleep(1500);
        // 全屏
        driver.manage().window().fullscreen();
        sleep(1500);
        // 最小化
        driver.manage().window().minimize();
        // 設置長寬
        driver.manage().window().setSize(new Dimension(600, 800));
    }
}

十.鍵盤

1.control + a:?
driver.findElement(By.cssSelector("#kw")).sendKeys(Keys.CONTROL, "A");

2.代碼

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import static java.lang.Thread.sleep;

public class Main4 {
    public static void main(String[] args) throws InterruptedException {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接百度
        driver.get("https://www.baidu.com/");
        driver.findElement(By.cssSelector("#kw")).sendKeys("君越艾維亞");
        // 鍵盤操作
        // control + A
        driver.findElement(By.cssSelector("#kw")).sendKeys(Keys.CONTROL, "A");
        sleep(1500);
        // control + X
        driver.findElement(By.cssSelector("#kw")).sendKeys(Keys.CONTROL, "X");
        sleep(1500);
        // control + V
        driver.findElement(By.cssSelector("#kw")).sendKeys(Keys.CONTROL, "V");
        sleep(1500);
    }
}

十一.鼠標

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

代碼:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;

import static java.lang.Thread.sleep;

public class Main5 {
    public static void main(String[] args) throws InterruptedException {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接百度
        driver.get("https://www.baidu.com/");
        driver.findElement(By.cssSelector("#kw")).sendKeys("君越艾維亞");
        driver.findElement(By.cssSelector("#su")).click();
        sleep(1500);
        // 鼠標操作
        WebElement element = driver.findElement(By.cssSelector("#s_tab > div > a.s-tab-item.s-tab-item_1CwH-.s-tab-pic_p4Uej.s-tab-pic"));
        Actions actions = new Actions(driver);
        sleep(1500);
        actions.moveToElement(element).contextClick().perform();

    }
}

十二.特殊場景

1.定位一組元素:?

勾選復選框

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.util.List;

public class Main6 {
    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接
        driver.get("???");
        List<WebElement> elements = driver.findElements(By.cssSelector("input"));
        // 遍歷elements,如果vtype值是checkbox就點擊
        // 使用
        for (int i = 0; i < elements.size(); ++i) {
            if (elements.get(i).getAttribute("type").contains("checkbox")) {
                elements.get(i).click();
            }
        }
    }
}

2.多框架定位: 在iframe中的a標簽使用常規(guī)方法無法定位

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class Main7 {
    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接
        driver.get("???");
        // 對iframe底下的a標簽進行操作,不能直接定位,需要先切換
        // 輸入id號,找到指定的iframe
        driver.switchTo().frame("f1");
        driver.findElement(By.cssSelector("???")).click();
    }

}

3.下拉框處理:

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.Select;

public class Main8 {
    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接
        driver.get("???");
        // 獲取下拉框的元素
        WebElement element = driver.findElement(By.cssSelector("???"));
        Select select = new Select(element);
        // 可以通過多種方式定位,常用以下兩種
        // 1.下標定位(下標從0開始計數(shù))
        select.deselectByIndex(0);
        // 2.根據(jù)value值定位
        select.deselectByValue("???");
    }
}

4.彈窗處理: 針對alert

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class Main9 {
    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接
        driver.get("???");
        // 點擊彈窗
        driver.findElement(By.cssSelector("button")).click();
        // 取消彈窗
        driver.switchTo().alert().dismiss();
        // 點擊彈窗
        driver.findElement(By.cssSelector("button")).click();
        // 輸入內(nèi)容
        driver.switchTo().alert().sendKeys("張三");
        // 點擊確認
        driver.switchTo().alert().accept();
    }
}

5.上傳文件

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class Main10 {
    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接
        driver.get("???");
        // 上傳文件
        driver.findElement(By.cssSelector("???")).sendKeys("此處填寫文件路徑");

    }
}

十三.補充

1.關閉瀏覽器

a)driver.quit();

退出瀏覽器,清空緩存(如cookie).

b)driver.close();

關閉當前正在操作的頁面(不是最新的頁面,要看當前正在操作的頁面)

c)代碼文章來源地址http://www.zghlxwxcb.cn/news/detail-713692.html

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import static java.lang.Thread.sleep;

public class Main11 {
    public static void main(String[] args) throws InterruptedException {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接百度
        driver.get("https://www.baidu.com/");
        driver.findElement(By.cssSelector("#s-top-left > a:nth-child(1)")).click();
        sleep(1500);
        //driver.close();
        driver.quit();
    }
}

2.切換窗口

a)driver.getWindowHandle();

獲取頁面句柄,不是最新的頁面,是當前正在操作的頁面.

b)Set<String> windowHandles = driver.getWindowHandles();

獲取所有頁面的局部,最后一個就是最新頁面的句柄.

c)代碼:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.util.Set;

public class Main12 {
    public static void main(String[] args) {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接百度
        driver.get("https://www.baidu.com/");
        // 點擊新的頁面
        driver.findElement(By.cssSelector("#s-top-left > a:nth-child(1)")).click();
        System.out.println(driver.getWindowHandle());
        String handle = null;
        Set<String> windowHandles = driver.getWindowHandles();
        for (String str : windowHandles) {
            handle = str;
            System.out.println(str);
        }
    }
}

運行結(jié)果:?

13.4web自動化測試(Selenium3+Java),測試工具,selenium,java,1024程序員節(jié)

3.截圖

a)去maven中央倉庫找common-io依賴(Apache Commons IO)

<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>

b) File screenshotAs = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
? ? FileUtils.copyFile(screenshotAs, new File("D://picture/123.png"));

c)代碼

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.io.File;
import java.io.IOException;

import static java.lang.Thread.sleep;

public class Main13 {
    public static void main(String[] args) throws IOException, InterruptedException {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 創(chuàng)建驅(qū)動
        WebDriver driver = new ChromeDriver(options);
        // 連接百度
        driver.get("https://www.baidu.com/");
        driver.findElement(By.cssSelector("#kw")).sendKeys("別克君越艾維亞");
        driver.findElement(By.cssSelector("#su")).click();
        sleep(1500);
        File screenshotAs = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
        FileUtils.copyFile(screenshotAs, new File("D://picture/123.png"));
    }
}

到了這里,關于13.4web自動化測試(Selenium3+Java)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權(quán),不承擔相關法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • 自動化測試之web自動化(Selenium)

    自動化測試之web自動化(Selenium)

    ??? 交流討論: 歡迎加入我們一起學習! ?? 資源分享 : 耗時200+小時精選的「軟件測試」資料包 ??? 教程推薦: 火遍全網(wǎng)的《軟件測試》教程?? ?? 歡迎點贊 ?? 收藏 ?留言 ?? 如有錯誤敬請指正! yycnblog 自動化測試概念:讓程序代替人為去驗證程序功能的過程,本

    2024年03月15日
    瀏覽(47)
  • selenium - web 自動化測試

    selenium - web 自動化測試

    有效的減少人力的消耗, 同時提高生活的質(zhì)量. 通過自動化測試有效減少人力的投入, 同時提高了測試的質(zhì)量和效率. 測試人員有個環(huán)節(jié)叫做回歸測試. 回歸測試 : 對歷史版本, 歷史功能進行測試, 保證功能都是符合要求的. 為什么需要回歸測試歷史版本 ? 因為新版本和舊版本一般

    2024年02月04日
    瀏覽(25)
  • Web自動化測試--selenium

    Web自動化測試--selenium

    ??? 交流討論: 歡迎加入我們一起學習! ?? 資源分享 : 耗時200+小時精選的「軟件測試」資料包 ??? 教程推薦: 火遍全網(wǎng)的《軟件測試》教程?? ?? 歡迎點贊 ?? 收藏 ?留言 ?? 如有錯誤敬請指正! Selenium 是支持web瀏覽器自動化的一系列工具和庫的綜合項目,能夠進

    2024年03月14日
    瀏覽(32)
  • 【自動化測試】基于Selenium + Python的web自動化框架

    【自動化測試】基于Selenium + Python的web自動化框架

    Selenium是一個基于瀏覽器的自動化工具,她提供了一種跨平臺、跨瀏覽器的端到端的web自動化解決方案。Selenium主要包括三部分:Selenium IDE、Selenium WebDriver 和Selenium Grid: ? 1、Selenium IDE:Firefox的一個擴展,它可以進行錄制回放,并可以把錄制的操作以多種語言(例如java,p

    2024年02月07日
    瀏覽(19)
  • Web自動化測試 Selenium 1/3

    Web自動化測試 Selenium 1/3

    ??? 交流討論: 歡迎加入我們一起學習! ?? 資源分享 : 耗時200+小時精選的「軟件測試」資料包 ??? 教程推薦: 火遍全網(wǎng)的《軟件測試》教程?? ?? 歡迎點贊 ?? 收藏 ?留言 ?? 如有錯誤敬請指正! 在這里,我還想說一下關于?Selenium?名字的來源,很有意思的?:??:

    2024年03月11日
    瀏覽(21)
  • selenium-web自動化測試

    selenium-web自動化測試

    步驟一:查看自己的谷歌瀏覽器版本(瀏覽器版本和驅(qū)動版本一定要對應) 步驟二:下載對應的驅(qū)動包, 下載路徑 :?ChromeDriver - WebDriver for Chrome - Downloads (chromium.org) ? 注意步驟二中, 只要保持 115.0.5790?一致即可, 最后一位數(shù)字我選擇102(網(wǎng)頁110下載不了所以選擇102) 步驟三:解

    2024年02月12日
    瀏覽(29)
  • Web自動化測試——selenium篇(一)

    Web自動化測試——selenium篇(一)

    在學習 Web 自動化測試的過程中,selenium 是其中的常用工具。除了其開源免費,包含豐富的 API 以外,它還支持多瀏覽器,多系統(tǒng),多語言等等優(yōu)點 這里將使用 Java 語言,在 谷歌瀏覽器(Chrome) 下來進行 selenium 工具的使用。 想要開展自動化測試,首先要保證環(huán)境已經(jīng)部署到

    2024年01月23日
    瀏覽(25)
  • Web自動化測試——selenium的使用

    Web自動化測試——selenium的使用

    ?? 前言 ?? 本篇文章就進入了 自動化測試 的章節(jié)了,如果作為一名測試開發(fā)人員,非常需要掌握自動化測試的能力,因為它不僅能減少人力的消耗,還能提升測試的效率。 ?? 歡迎點贊 ?? 收藏 ? 留言評論 ?? 私信必回喲 ?? ?? 博主將持續(xù)更新學習記錄收獲,友友們

    2024年02月01日
    瀏覽(47)
  • Selenium Web自動化測試框架實踐

    Selenium Web自動化測試框架實踐

    目錄 ? ? ? ?前言: 項目背景 功能實現(xiàn) 項目架構(gòu) 瀏覽器driver定義 用例運行前后的環(huán)境準備工作 工具方法模塊 Pageobject頁面對象封裝 執(zhí)行測試用例 ? ? ? ?前言: ? ? ? ? ?Selenium是一個基于Web的自動化測試框架,可以通過模擬用戶在瀏覽器上的操作,來自動化地測試Web應

    2024年02月10日
    瀏覽(27)
  • Web測試自動化工具Selenium的使用

    Selenium是一個Web應用測試的自動化工具,它通過模擬點擊實現(xiàn)對Web應用的功能測試。測試時,除了Selenium,還需要對應的瀏覽器驅(qū)動,如在Chrome實現(xiàn)自動點擊,則需要chromedriver。 Selenium支持多種語言和多種瀏覽器,本文僅記錄python+chrome的使用。 1. 安裝python 略 2. 安裝Selenium 注

    2024年01月16日
    瀏覽(95)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包