新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

Se(15)对象的状态-创新互联

package test;

成都创新互联专注于企业营销型网站建设、网站重做改版、墨脱网站定制设计、自适应品牌网站建设、H5响应式网站商城网站制作、集团公司官网建设、外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为墨脱等各大城市提供网站开发制作服务。

import org.openqa.selenium.By;

import org.openqa.selenium.NoSuchElementException;

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(){

System.setProperty("webdriver.chrome.driver", "D:/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/status.html");

//isExist

try {

WebElement el = dr.findElement(By.id("12345"));

System.out.println("the element is e1");

} catch (NoSuchElementException e) {

System.out.println("no such element e1");

}

try {

WebElement e2 = dr.findElement(By.name("user"));

System.out.println("the element is e2");

} catch (NoSuchElementException e) {

System.out.println("no such element e2");

}

  //isDisplayed

WebElement e3 = dr.findElement(By.name("radio"));

if (e3.isDisplayed()) {

System.out.println("e3显示");

}

else {

System.out.println("e3不显示");

}

       //isEnabled

WebElement e4 = dr.findElement(By.name("user"));

if (e4.isEnabled()) {

System.out.println("e4可用");

}

else {

System.out.println("出错了,e4不可用");

}

//isSelected

WebElement e5 = dr.findElement(By.name("radio"));

if (e5.isSelected()) {

System.out.println("e5被选中");

}

else {

System.out.println("出错了,没有被选中");

}

//dr.quit();

}

}

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


文章标题:Se(15)对象的状态-创新互联
链接分享:http://www.wjwzjz.com/article/ccddcp.html
在线咨询
服务热线
服务热线:028-86922220
TOP