Codota Logo
TagComponentList
Code IndexAdd Codota to your IDE (free)

How to use
TagComponentList
in
io.github.seleniumquery.by.firstgen.xpath

Best Java code snippets using io.github.seleniumquery.by.firstgen.xpath.TagComponentList (Showing top 15 results out of 315)

  • Common ways to obtain TagComponentList
private void myMethod () {
TagComponentList t =
  • Codota IconString selector;XPathComponentCompilerService.compileSelectorList(selector)
  • Smart code suggestions by Codota
}
origin: seleniumQuery/seleniumQuery

/**
 * Compiles the selector for the given context (the context will determinate what selectors are natively
 * supported and what selectors should be handled by SeleniumQuery programatically) and matches elements based on it.
 */
@Override
public List<WebElement> findElements(SearchContext context, String selector) {
  TagComponentList xPathLocator = XPathComponentCompilerService.compileSelectorList(selector);
  return xPathLocator.findWebElements(context);
}
origin: seleniumQuery/seleniumQuery

@Override
public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) {
  String notSelector = pseudoClassSelector.getPseudoClassContent();
  String insideHasXPath = XPathComponentCompilerService.compileSelectorList(notSelector).toXPath();
  insideHasXPath = insideHasXPath.substring(1, insideHasXPath.length()-1);
  return new ConditionSimpleComponent("[" + insideHasXPath + "]");
}

origin: seleniumQuery/seleniumQuery

public static TagComponentList compileSelectorList(String selector) {
  W3cCssSelectorListWithMap parsedSelectorList = W3cCssSelectorWithMapParser.parseSelector(selector);
  List<TagComponent> tagComponents = new ArrayList<>(parsedSelectorList.size());
 parsedSelectorList.forEach(w3cCssSelectorWithMap -> {
   tagComponents.add(compileIntoTagComponent(w3cCssSelectorWithMap));
 });
  return new TagComponentList(tagComponents);
}
origin: seleniumQuery/seleniumQuery

@Override
public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) {
  String notSelector = pseudoClassSelector.getPseudoClassContent();
  String insideNotXPath = XPathComponentCompilerService.compileSelectorList(notSelector).toXPathCondition();
  return new ConditionSimpleComponent("[not(" + insideNotXPath + ")]");
}

origin: seleniumQuery/seleniumQuery

@Override
public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) {
  String notSelector = pseudoClassSelector.getPseudoClassContent();
  String insideNotXPath = XPathComponentCompilerService.compileSelectorList(notSelector).toXPathCondition();
  return new ConditionSimpleComponent("[not(" + insideNotXPath + ")]");
}

origin: seleniumQuery/seleniumQuery

/**
 * Compiles the selector for the given context (the context will determinate what selectors are natively
 * supported and what selectors should be handled by SeleniumQuery programatically) and matches elements based on it.
 */
@Override
public List<WebElement> findElements(SearchContext context, String selector) {
  TagComponentList xPathLocator = XPathComponentCompilerService.compileSelectorList(selector);
  return xPathLocator.findWebElements(context);
}
origin: seleniumQuery/seleniumQuery

@Override
public ConditionSimpleComponent pseudoClassToXPath(PseudoClassSelector pseudoClassSelector) {
  String notSelector = pseudoClassSelector.getPseudoClassContent();
  String insideHasXPath = XPathComponentCompilerService.compileSelectorList(notSelector).toXPath();
  insideHasXPath = insideHasXPath.substring(1, insideHasXPath.length()-1);
  return new ConditionSimpleComponent("[" + insideHasXPath + "]");
}

origin: seleniumQuery/seleniumQuery

public static TagComponentList compileSelectorList(String selector) {
  W3cCssSelectorListWithMap parsedSelectorList = W3cCssSelectorWithMapParser.parseSelector(selector);
  List<TagComponent> tagComponents = new ArrayList<>(parsedSelectorList.size());
 parsedSelectorList.forEach(w3cCssSelectorWithMap -> {
   tagComponents.add(compileIntoTagComponent(w3cCssSelectorWithMap));
 });
  return new TagComponentList(tagComponents);
}
origin: seleniumQuery/seleniumQuery

@Override
public boolean isPseudoClass(WebDriver driver, WebElement element, PseudoClassSelector pseudoClassSelector) {
  String hasSelector = pseudoClassSelector.getPseudoClassContent();
  
  TagComponentList compiledSelector = XPathComponentCompilerService.compileSelectorList(hasSelector);
  List<WebElement> elements = compiledSelector.findWebElements(driver);
  
  return !elements.isEmpty();
}

origin: seleniumQuery/seleniumQuery

@Test
public void attribute_escaping__maybe_should_change() {
  String selector = "[attr=\"a\\\"bc\"]"; // [attr="a\"bc"]
  TagComponentList compileSelectorList = XPathComponentCompilerService.compileSelectorList(selector);
  String xPath = compileSelectorList.toXPath();
  assertThat(xPath, is("(.//*[@*[translate(name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'attr'] = 'a\\\"bc'])")); // (.//*[@attr = 'a\"bc'])
}
origin: seleniumQuery/seleniumQuery

@Override
public boolean isPseudoClass(WebDriver driver, WebElement element, PseudoClassSelector pseudoClassSelector) {
  String hasSelector = pseudoClassSelector.getPseudoClassContent();
  
  TagComponentList compiledSelector = XPathComponentCompilerService.compileSelectorList(hasSelector);
  List<WebElement> elements = compiledSelector.findWebElements(driver);
  
  return !elements.isEmpty();
}

origin: seleniumQuery/seleniumQuery

@Test
public void toXPath__id() {
  TagComponentList compileSelectorList = XPathComponentCompilerService.compileSelectorList("#ball");
  assertThat(compileSelectorList.toXPath(), is("(.//*[@id = 'ball'])"));
}
origin: seleniumQuery/seleniumQuery

@Test
public void findWebElements_should_call_findElementsByXPath() {
  // given
  TagComponentList tagComponentList = XPathComponentCompilerService.compileSelectorList("span");
  SearchContext searchContext = createSearchContextThatReturnsWebElementsForXPath("(.//*[self::span])", dummyWebElements);
  // when
  List<WebElement> webElements = tagComponentList.findWebElements(searchContext);
  // then
  assertThat(webElements, is(dummyWebElements));
}
origin: seleniumQuery/seleniumQuery

@Test
public void toXPath__and_conditional() {
  TagComponentList compileSelectorList = XPathComponentCompilerService.compileSelectorList(".a.b");
  assertThat(compileSelectorList.toXPath(), is("(.//*[contains(concat(' ', normalize-space(@class), ' '), ' a ') and contains(concat(' ', normalize-space(@class), ' '), ' b ')])"));
}
origin: seleniumQuery/seleniumQuery

@Test
public void findWebElements_if_selector_is_just_an_id_it_should_call_findElementById() {
  // given
  TagComponentList tagComponentList = XPathComponentCompilerService.compileSelectorList("#idz");
  SearchContext searchContext = createSearchContextThatReturnsWebElementForId("idz", firstDummyWebElement);
  // when
  List<WebElement> webElements = tagComponentList.findWebElements(searchContext);
  // then
  assertThat(webElements, contains(firstDummyWebElement));
}
io.github.seleniumquery.by.firstgen.xpathTagComponentList

Javadoc

Represents a list of io.github.seleniumquery.by.firstgen.xpath.component.XPathComponent. In other words, multiple XPath expressions that should be "composed" or "merged" to become a single expression.

Most used methods

  • findWebElements
  • toXPath
  • <init>
  • toXPathCondition

Popular in Java

  • Start an intent from android
  • requestLocationUpdates (LocationManager)
  • orElseThrow (Optional)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now