airware-legacy / webdriver-mocha-async-await-example Goto Github PK
View Code? Open in Web Editor NEWUsing Mocha, Selenium Webdriver, and Babel together to provide async / await to browser e2e tests
Using Mocha, Selenium Webdriver, and Babel together to provide async / await to browser e2e tests
Hi
Would it be possible to add an example of using takeScreenshot? I have tried to get this working without success. Currently I'm getting an Exception with an unknown error.
Thanks
Is it possible to get this code to work without using Babel/transpiling? I read that v7.0.0 of Node has async/await built in now and wanted to try it out.
When waiting for element visibility, I noticed that when my browser window is too small, the expected element will never become visible. During the wait, the driver floods console like this:
16:00:30.504 INFO - Executing: [is displayed: 1 [[ChromeDriver: chrome on LINUX (5fa3bd0bd421939f497148d624ecb97d)] -> css selector: a[href="/config"]]])
16:00:30.513 INFO - Done: [is displayed: 1 [[ChromeDriver: chrome on LINUX (5fa3bd0bd421939f497148d624ecb97d)] -> css selector: a[href="/config"]]]
16:00:30.518 INFO - Executing: [is displayed: 1 [[ChromeDriver: chrome on LINUX (5fa3bd0bd421939f497148d624ecb97d)] -> css selector: a[href="/config"]]])
16:00:30.530 INFO - Done: [is displayed: 1 [[ChromeDriver: chrome on LINUX (5fa3bd0bd421939f497148d624ecb97d)] -> css selector: a[href="/config"]]]
16:00:30.535 INFO - Executing: [is displayed: 1 [[ChromeDriver: chrome on LINUX (5fa3bd0bd421939f497148d624ecb97d)] -> css selector: a[href="/config"]]])
16:00:30.544 INFO - Done: [is displayed: 1 [[ChromeDriver: chrome on LINUX (5fa3bd0bd421939f497148d624ecb97d)] -> css selector: a[href="/config"]]]
16:00:30.547 INFO - Executing: [is displayed: 1 [[ChromeDriver: chrome on LINUX (5fa3bd0bd421939f497148d624ecb97d)] -> css selector: a[href="/config"]]])
16:00:30.556 INFO - Done: [is displayed: 1 [[ChromeDriver: chrome on LINUX (5fa3bd0bd421939f497148d624ecb97d)] -> css selector: a[href="/config"]]]
Is this behavior normal? The retry logic seems to work though and the test fails eventually.
I'm using mocha with a .babelrc (stage-2 for async/await).
Hello,
After watching the video of your demo at the Selenium conf, I'm interested by going deeper into the use of webdriverjs with async/await.
However I'm experiencing some issues while trying to use your example.
After cloning successfully the project, I did the following console commands:
$ nvm use 7.7.2
Now using node v7.7.2 (npm v4.1.2)
$ npm install --save-dev
...
-----
selenium-standalone installation finished
-----
And all the dependencies ...
Everything seems to be fine for the moment.
However, trying to run npm test
tells me that a plugin is missing :
$ npm test
> [email protected] test /Users/tbo/Code/webdriver-mocha-async-await-example
> _mocha
/Users/tbo/Code/webdriver-mocha-async-await-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180
throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
^
ReferenceError: Unknown plugin "transform-flow-strip-types" specified in "/Users/tbo/Code/webdriver-mocha-async-await-example/.babelrc" at 0, attempted to resolve relative to "/Users/tbo/Code/webdriver-mocha-async-await-example"
Ok got it, transform-flow-strip-types
is missing, so I'm manually adding it via $ npm install babel-plugin-transform-flow-strip-types
Another $ npm test
return another similar plugin error : ReferenceError: Unknown plugin "transform-object-rest-spread"
I'm then manually adding it via npm.
Running again npm test
throw me a new error :
1) Acceptance Tests "before each" hook:
Uncaught WebDriverError: The driver executable does not exist: /Users/tbo/Code/applications/web/tests/node_modules/selenium-standalone/.selenium/chromedriver/2.27-x64-chromedriver
This is where I'm blocked.
The file is indeed not existing at this path. And I don't understand why npm test is looking at this path.
However it exist at the "correct" path : /Users/tbo/Code/webdriver-mocha-async-await-example/node_modules/selenium-standalone/.selenium/chromedriver/2.27-x64-chromedriver
So my question is why does npm test
try to access to an inexistent path ?
I'm relatively new on Node but I run other webdriverjs projects without any problem.
Any idea ?
The full error log can be viewed there.
FYI, $ chromedriver
is working well (so chromedriver is in my PATH)
$ chromedriver
Starting ChromeDriver 2.28.455517 (2c6d2707d8ea850c862f04ac066724273981e88f) on port 9515
Only local connections are allowed.
As well as npm start
$ npm start
> [email protected] start /Users/tbo/Code/webdriver-mocha-async-await-example
> selenium-standalone start
11:01:02.554 INFO - Launching a standalone Selenium Server
11:01:02.597 INFO - Java: Oracle Corporation 25.112-b16
11:01:02.597 INFO - OS: Mac OS X 10.12.3 x86_64
11:01:02.614 INFO - v2.53.1, with Core v2.53.1. Built from revision a36b8b1
11:01:02.682 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
11:01:02.683 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
11:01:02.683 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:01:02.683 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
11:01:02.685 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver
11:01:02.685 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
11:01:02.768 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
11:01:02.768 INFO - Selenium Server is up and running
Selenium started
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.