angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

className locator is trying to resolve with cssSelector #5489

Open ravi005e opened 3 years ago

ravi005e commented 3 years ago

protected fetchBy(elementPair: KeyValuePair): any { const selector: string = elementPair.selector; const locatorType: LocatorType = elementPair.locatorType;

this.getLogger().info('fetching element with locator ['+ locatorType +'], selector ['+ selector +']');
switch (locatorType) {
  case LocatorType.CLASS:
    return By.className(selector);
  case LocatorType.CSS:
    return By.cssSelector(selector);
  case LocatorType.ID:
    return By.id(selector);
  case LocatorType.LINK_TEXT:
    return By.linkText(selector);
  case LocatorType.PARTIAL_LINK_TEXT:
    return By.partialLinkText(selector);
  case LocatorType.TAG:
    return By.tagName(selector);
  case LocatorType.XPATH:
    return By.xpath(selector);
  case LocatorType.NAME:
    return By.name(selector);
  default:
    throw new Error("Unsupported operation has occured, should\'t have reached 'default' state");
}

}

2021-01-17 19:57:54.669 - ResultsPage:[INFO]: fetching element with locator [className], selector [rc] <-- here, this is what I'm passing

(node:6284) UnhandledPromiseRejectionWarning: NoSuchElementError: No element found using locator: By(css selector, .rc) <-- here at F:\protractor_framework_jasmine\node_modules\protractor\built\element.js:814:27 at processTicksAndRejections (internal/process/taskqueues.js:93:5)Error at ElementArrayFinder.applyAction (F:\protractor_framework_jasmine\node_modules\protractor\built\element.js:459:27)
at ElementArrayFinder

ravi005e commented 3 years ago

additional method /**