Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Se (13) buttongroup, breadcrump, etc.

Shulou Source: shulou.com Published: 2022-06-03 05:52:11 11月23日 Update

Package test

Import java.util.List

Import org.openqa.selenium.By

Import org.openqa.selenium.WebDriver

Import org.openqa.selenium.WebElement

Import org.openqa.selenium.chrome.ChromeDriver

Import org.testng.annotations.Test

Public class buttongroup {

@ Test

Public void test () throws InterruptedException {

System.setProperty ("webdriver.chrome.driver", "DJV 01 Learn WebDriver/chromedriver.exe")

WebDriver dr = new ChromeDriver ()

Dr.manage (). Window (). Maximize ()

/ / dr.get ("file:///C:/Users/fengchuanyun/Desktop/1/%E8%87%AA%E5%8A%A8%E5%8C%96%E7%BB%83%E4%B9%A0/button%20group.html");

/ * List bns = dr.findElement (By.className ("btn-group")) .findElements (By.className ("btn"))

For (WebElement bn: bns) {

If (bn.getText () .equals ("second")) {

Bn.click ()

Break

}

} * /

/ * List bns = dr.findElements (By.className ("btn"))

Bns.get (1) .click ()

} * /

/ * WebElement bn = dr.findElement (By.xpath ("/ html/body/div/div/div/div/div/div [1]"))

Bn.click (); * /

/ / Bread crumbs

Dr.get ("http://sports.sina.com.cn/basketball/nba/2017-05-07/doc-ifyeychk7096356.shtml");"

/ * WebElement bn = dr.findElement (By.xpath ("/ / * [@ id='j_nav_2'] / div [1] / a [2]"))

Bn.click (); * /

Thread.sleep (3000)

List el = dr.findElement (By.cssSelector (".nav-g__breadcrumb")) .findElements (By.tagName ("a"))

El.get (el.size ()-1). Click ()

/ / dr.quit ()

}

}

Tags: Bread crumbs Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Technology vpn Shulou Tech Info Shulou Information