Can't use WebDriver grab methods - unexpected identifier
See original GitHub issueI’m using Selenium and Firefox. I’m trying to use I.grabTextFrom or I.grabAttributeFrom, and I get the error:
CodeceptJS v0.3.3
Test root is assumed to be /Users/andrew/code/myapp
Unexpected identifier
SyntaxError:
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:404:25)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at /Users/andrew/.nvm/versions/node/v5.1.1/lib/node_modules/codeceptjs/node_modules/mocha/lib/mocha.js:219:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/andrew/.nvm/versions/node/v5.1.1/lib/node_modules/codeceptjs/node_modules/mocha/lib/mocha.js:216:14)
I’ve defined an element in my dom, with an id ‘test’, and a value ‘foo’:
<div id="test">Foo</div>
And I try to grab the value:
var test = yield I.grabTextFrom('#test');
This causes the above error. Not sure why.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Can't use WebDriver grab methods - unexpected identifier #111
I'm using Selenium and Firefox. I'm trying to use I.grabTextFrom or I.grabAttributeFrom, and I get the error: CodeceptJS v0.3.3 Test root is ...
Read more >Unexpected identifier in selenium-webdriver/lib/http.js:454 ...
I ran into this issue. Run node -v if your version is under 8 it doesn't have the ability to handle the async...
Read more >JavascriptExecutor SyntaxError: Unexpected identifier. Why?
All syntax errors should be gone, but I still get "SyntaxError: Unexpected identifier". What this code is trying to do is wait for...
Read more >T236282 `npm run selenium` fails on MW Vagrant (SyntaxError
`npm run selenium` fails on MW Vagrant (SyntaxError: Unexpected identifier; due to Node 6). Closed, DuplicatePublic.
Read more >Working with windows and tabs - Selenium
If not running WebDriver in a test context, you may consider using try / finally which is offered by most languages so that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@andrewhl , I’ve figured out the reason, at least for my instance of the bug, and it’s entirely user error. When I RTFM, I realized that I wasn’t using a generator function for the scenario. From the documentation:
Without it being a generator function, that yield keyword is nonsense to the JS engine, hence the unknown identifier error.
I am reproducing this same error.
So simply going to Google and getting the title causes this issue. Removing the
grabTitle
line makes the error go away. Stacktrace is the same as OP.Versions: Codecept: 0.3.5 Node: 4.4.5 Windows: 10