protractor-cucumber icon indicating copy to clipboard operation
protractor-cucumber copied to clipboard

World 'by' object incorrect

Open edmulraney opened this issue 9 years ago • 5 comments

Hi,

The World object's 'by' property won't work as it's currently set: lib/index.js Line 29: this.by = protractor.By;

It worked when we set it to:

this.by = webdriver.By;

edmulraney avatar Oct 23 '15 00:10 edmulraney

Observation (using protractor 3.0.0 and cucumber.js 0.9.2 and node 4.2.3 or 5.0.0):

For by.css and by.xpath I suddenly got:

  TypeError: Invalid locator
      at Function.webdriver.Locator.checkLocator (<project>/node_modules/protractor-cucumber/node_modules/selenium-webdriver/lib/webdriver/locators.js:248:9)

but not for by.model, by.buttonText.

with the above adjustment it works but I dont understand the approach then the protractor selectors can be called that way. which might be ok they can just be called through this.protractor ...

pellekrogholt avatar Jan 12 '16 12:01 pellekrogholt

:+1: Patch brought my code to life, too.

leegee avatar Feb 23 '16 09:02 leegee

Patch worked for me too.

protractor-cucumber: 0.1.8 cucumber.js : 0.10.2 protractor: 3.1.1 (same error with 3.2.2)

Got the error when using by.css (Invalid Locator) with chrome & firefox

TypeError: Invalid locator
         at Function.webdriver.Locator.checkLocator (node_modules/selenium-webdriver/lib/webdriver/locators.js:247:9)
         at webdriver.WebDriver.findElements (node_modules/selenium-webdriver/lib/webdriver/webdriver.js:995:31)
         at node_modules/protractor/built/element.js:137:30
         at promise.Promise.goog.defineClass.invokeCallback_ (node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1337:14)
         at promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_.execute_ node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2776:14)
         at promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_ (node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21)
         at goog.async.run.processWorkQueue (node_modules/selenium-webdriver/lib/goog/async/run.js:124:15)
         at process._tickCallback (internal/process/next_tick.js:103:7)

gorghoa avatar Apr 13 '16 15:04 gorghoa

I switched to protractor-cucumber-framework -- don't let the lack of docs fool you, it is well-maintained, and is only undocumented because it doesn't really need docs.

leegee avatar Apr 13 '16 15:04 leegee

Hi @leegee, switching to protractor-cucumber-framework is indeed a smart move :+1:

gorghoa avatar Apr 19 '16 14:04 gorghoa