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


Java FindsByCssSelector类代码示例

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


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

示例1: getDescription

import org.openqa.selenium.internal.FindsByCssSelector; //导入依赖的package包/类
private DesiredCapabilities getDescription(WebDriver instance, Capabilities capabilities) {
  DesiredCapabilities caps = new DesiredCapabilities(capabilities.asMap());
  caps.setJavascriptEnabled(instance instanceof JavascriptExecutor);
  if (instance instanceof TakesScreenshot) {
    caps.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
  }
  if (instance instanceof LocationContext) {
    caps.setCapability(CapabilityType.SUPPORTS_LOCATION_CONTEXT, true);
  }
  if (instance instanceof ApplicationCache) {
    caps.setCapability(CapabilityType.SUPPORTS_APPLICATION_CACHE, true);
  }
  if (instance instanceof NetworkConnection) {
    caps.setCapability(CapabilityType.SUPPORTS_NETWORK_CONNECTION, true);
  }
  if (instance instanceof WebStorage) {
    caps.setCapability(CapabilityType.SUPPORTS_WEB_STORAGE, true);
  }
  if (instance instanceof FindsByCssSelector) {
    caps.setCapability(CapabilityType.SUPPORTS_FINDING_BY_CSS, true);
  }
  if (instance instanceof Rotatable) {
    caps.setCapability(CapabilityType.ROTATABLE, true);
  }
  if (instance instanceof HasTouchScreen) {
    caps.setCapability(CapabilityType.HAS_TOUCHSCREEN, true);
  }
  return caps;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:30,代码来源:DefaultSession.java

示例2: RobustElementWrapper

import org.openqa.selenium.internal.FindsByCssSelector; //导入依赖的package包/类
/**
 * Main robust web element constructor
 * 
 * @param element element reference to be wrapped (may be 'null')
 * @param context element search context
 * @param locator element locator
 * @param index element index
 */
public RobustElementWrapper(WebElement element, WrapsContext context, By locator, int index) {
    
    // if specified element is already robust
    if (element instanceof RobustWebElement) {
        RobustElementWrapper wrapper = ((InterceptionAccessor) element).getInterceptor();
        this.acquiredAt = wrapper.acquiredAt;
        
        this.wrapped = wrapper.wrapped;
        this.context = wrapper.context;
        this.locator = wrapper.locator;
        this.index = wrapper.index;
    } else {
        Objects.requireNonNull(context, "[context] must be non-null");
        Objects.requireNonNull(locator, "[locator] must be non-null");
        if (index < OPTIONAL) {
            throw new IndexOutOfBoundsException("Specified index is invalid");
        }
        
        this.wrapped = element;
        this.context = context;
        this.locator = locator;
        this.index = index;
    }
    
    driver = WebDriverUtils.getDriver(this.context.getWrappedContext());
    
    findsByCssSelector = (driver instanceof FindsByCssSelector);
    findsByXPath = (driver instanceof FindsByXPath);
    
    if ((this.index == OPTIONAL) || (this.index > 0)) {
        if (findsByXPath && ( ! (this.locator instanceof By.ByCssSelector))) {
            selector = ByType.xpathLocatorFor(this.locator);
            if (this.index > 0) {
                selector += "[" + (this.index + 1) + "]";
            }
            strategy = Strategy.JS_XPATH;
            
            this.locator = By.xpath(this.selector);
        } else if (findsByCssSelector) {
            selector = ByType.cssLocatorFor(this.locator);
            if (selector != null) {
                strategy = Strategy.JS_CSS;
            }
        }
    }
    
    if (this.wrapped == null) {
        if (this.index == OPTIONAL) {
            acquireReference(this);
        } else {
            refreshReference(null);
        }
    } else if (acquiredAt == 0) {
        acquiredAt = System.currentTimeMillis();
    }
}
 
开发者ID:Nordstrom,项目名称:Selenium-Foundation,代码行数:65,代码来源:RobustElementFactory.java

示例3: findElementByCssSelector

import org.openqa.selenium.internal.FindsByCssSelector; //导入依赖的package包/类
/**
 * Finds element by css selector.
 */
@Override
public WebElement findElementByCssSelector(String cssSelector) {
  return ((FindsByCssSelector) super.getWrappedDriver()).findElementByCssSelector(cssSelector);
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:8,代码来源:WebDriverWrapper.java

示例4: findElementsByCssSelector

import org.openqa.selenium.internal.FindsByCssSelector; //导入依赖的package包/类
/**
 * Finds elements by css selector.
 */
@Override
public List<WebElement> findElementsByCssSelector(String cssSelector) {
  return ((FindsByCssSelector) super.getWrappedDriver()).findElementsByCssSelector(cssSelector);
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:8,代码来源:WebDriverWrapper.java

示例5: findElementByCssSelector

import org.openqa.selenium.internal.FindsByCssSelector; //导入依赖的package包/类
@Override
public WebElement findElementByCssSelector(String using) {
    return targetedWebElement(((FindsByCssSelector) element()).findElementByCssSelector(using));
}
 
开发者ID:darcy-framework,项目名称:darcy-webdriver,代码行数:5,代码来源:TargetedWebElement.java

示例6: findElementsByCssSelector

import org.openqa.selenium.internal.FindsByCssSelector; //导入依赖的package包/类
@Override
public List<WebElement> findElementsByCssSelector(String using) {
    return targetedWebElements(((FindsByCssSelector) element()).findElementsByCssSelector(using));
}
 
开发者ID:darcy-framework,项目名称:darcy-webdriver,代码行数:5,代码来源:TargetedWebElement.java

示例7: findElementByCssSelector

import org.openqa.selenium.internal.FindsByCssSelector; //导入依赖的package包/类
@Override
public WebElement findElementByCssSelector(String using) {
    return targetedWebElement(((FindsByCssSelector) driver()).findElementByCssSelector(using));
}
 
开发者ID:darcy-framework,项目名称:darcy-webdriver,代码行数:5,代码来源:ForwardingTargetedWebDriver.java

示例8: findElementsByCssSelector

import org.openqa.selenium.internal.FindsByCssSelector; //导入依赖的package包/类
@Override
public List<WebElement> findElementsByCssSelector(String using) {
    return targetedWebElements(((FindsByCssSelector) driver()).findElementsByCssSelector(using));
}
 
开发者ID:darcy-framework,项目名称:darcy-webdriver,代码行数:5,代码来源:ForwardingTargetedWebDriver.java


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