当前位置: 首页>>代码示例>>Java>>正文


Java ByCssSelector类代码示例

本文整理汇总了Java中org.openqa.selenium.By.ByCssSelector的典型用法代码示例。如果您正苦于以下问题:Java ByCssSelector类的具体用法?Java ByCssSelector怎么用?Java ByCssSelector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ByCssSelector类属于org.openqa.selenium.By包,在下文中一共展示了ByCssSelector类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testData

import org.openqa.selenium.By.ByCssSelector; //导入依赖的package包/类
@DataProvider(name = "locatorDP")
public static Iterator<Object[]> testData() {
	ArrayList<Object[]> data = new ArrayList<Object[]>();

	data.add(new Object[]{"id=eleId", ById.class});
	data.add(new Object[]{"name=eleName", ByName.class});
	data.add(new Object[]{"css=#eleId.className", ByCssSelector.class});
	data.add(new Object[]{"tagName=div", ByTagName.class});
	data.add(new Object[]{"link=Link Text", ByLinkText.class});
	data.add(new Object[]{"partialLink=Link Text", ByPartialLinkText.class});
	data.add(new Object[]{"['css=#qa','name=eleName']", ByAny.class});

	// self descriptive
	data.add(new Object[]{"{'locator' : 'id=eleId'; 'desc' : 'locate element by id'}",
			ById.class});
	data.add(new Object[]{
			"{'locator' : 'name=eleName'; 'desc' : 'locate element by name'}",
			ByName.class});
	data.add(new Object[]{
			"{'locator' : 'css=#eleId.className'; 'desc' : 'locate element by css'}",
			ByCssSelector.class});

	data.add(new Object[]{
			"{'locator' : ['css=#qa','name=eleName']; 'desc' : 'locate element by css'}",
			ByAny.class});

	data.add(new Object[]{"xpath=//*[text()='Albany-Rensselaer, NY (ALB)']",
			ByXPath.class});
	return data.iterator();
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:31,代码来源:LocatorUtilTest.java

示例2: shouldRegisterWhenFlattenedLocatorFileIsLoaded

import org.openqa.selenium.By.ByCssSelector; //导入依赖的package包/类
@Test
public void shouldRegisterWhenFlattenedLocatorFileIsLoaded() throws URISyntaxException {
    File locatorFile = new File(LocatorRegistryTest.class.getResource("/conf/flattened/locator.yml").toURI());
    LocatorRegistry locatorRegistry = new LocatorRegistry(new Properties(), locatorFile);

    assertTrue(locatorRegistry.getLocator("my-button") instanceof ByCssSelector);
    assertTrue(locatorRegistry.getLocator("my-input") instanceof ByXPath);
    assertTrue(locatorRegistry.getLocator("my-frame") instanceof ById);

    assertEquals(new ByCssSelector("#mypage .mybutton"), locatorRegistry.getLocator("my-button"));
    assertEquals(new ByXPath("//input[@class='myinput']"), locatorRegistry.getLocator("my-input"));
    assertEquals(new ById("myframe"), locatorRegistry.getLocator("my-frame"));
}
 
开发者ID:MagenTys,项目名称:cinnamon,代码行数:14,代码来源:LocatorRegistryTest.java

示例3: shouldRegisterDefaultProfileWhenLocatorPropertyIsNotSet

import org.openqa.selenium.By.ByCssSelector; //导入依赖的package包/类
@Test
public void shouldRegisterDefaultProfileWhenLocatorPropertyIsNotSet() throws URISyntaxException {
    File locatorFile = new File(LocatorRegistryTest.class.getResource("/conf/hierarchical/locator.yml").toURI());
    LocatorRegistry locatorRegistry = new LocatorRegistry(new Properties(), locatorFile);

    assertTrue(locatorRegistry.getLocator("my-button") instanceof ByCssSelector);
    assertTrue(locatorRegistry.getLocator("my-input") instanceof ByXPath);
    assertTrue(locatorRegistry.getLocator("my-frame") instanceof ById);

    assertEquals(new ByCssSelector("#mypage .mybutton"), locatorRegistry.getLocator("my-button"));
    assertEquals(new ByXPath("//input[@class='myinput']"), locatorRegistry.getLocator("my-input"));
    assertEquals(new ById("myframe"), locatorRegistry.getLocator("my-frame"));
}
 
开发者ID:MagenTys,项目名称:cinnamon,代码行数:14,代码来源:LocatorRegistryTest.java

示例4: shouldRegisterUserSpecifiedProfileWhenLocatorPropertyIsSet

import org.openqa.selenium.By.ByCssSelector; //导入依赖的package包/类
@Test
public void shouldRegisterUserSpecifiedProfileWhenLocatorPropertyIsSet() throws URISyntaxException {
    Properties properties = new Properties();
    properties.setProperty("locator", "override");
    File locatorFile = new File(LocatorRegistryTest.class.getResource("/conf/hierarchical/locator.yml").toURI());
    LocatorRegistry locatorRegistry = new LocatorRegistry(properties, locatorFile);

    assertTrue(locatorRegistry.getLocator("my-button") instanceof ByCssSelector);
    assertTrue(locatorRegistry.getLocator("my-input") instanceof ByXPath);
    assertTrue(locatorRegistry.getLocator("my-frame") instanceof ById);

    assertEquals(new ByCssSelector("#overridepage .overridebutton"), locatorRegistry.getLocator("my-button"));
    assertEquals(new ByXPath("//input[@class='myinput']"), locatorRegistry.getLocator("my-input"));
    assertEquals(new ById("myframe"), locatorRegistry.getLocator("my-frame"));
}
 
开发者ID:MagenTys,项目名称:cinnamon,代码行数:16,代码来源:LocatorRegistryTest.java

示例5: testLocator

import org.openqa.selenium.By.ByCssSelector; //导入依赖的package包/类
@Test
public void testLocator() {
	getBundle().setProperty("test.loc",
			"{'locator':'css=a','desc':' Trip type check box'}");
	assertThat(LocatorUtil.getBy("test.loc"), instanceOf(ByCssSelector.class));
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:7,代码来源:LocatorUtilTest.java


注:本文中的org.openqa.selenium.By.ByCssSelector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。