Selenium IDE has stopped working on the latest Firefox. Along with this, development seems to have started also with IDE running with a new API, but waiting for it will be painful. It is also a matter of continuing to use the old version.
I would like to use the UI Recorder there. It is operation recording software of newly introduced Selenium IDE like web browser.
How to use UI Recorder
The UI Recorder first creates a directory and initializes it.
- $ uirecorder init
- __ ______ ____ __
- / / / / _/ / __ \___ _________ _________/ /__ _____
- / / / // / / /_/ / _ \/ ___/ __ \/ ___/ __ / _ \/ ___/
- / /_/ // / / _, _/ __/ /__/ /_/ / / / /_/ / __/ /
- \____/___/ /_/ |_|\___/\___/\____/_/ \__,_/\___/_/ v2.5.32
- Official Site: http://uirecorder.com
- ------------------------------------------------------------------
- ? Dom path config, extend: id, name, class data-id,data-name,type,data-type,role,data-role,data-value
- ? Black list RegExp for attribute value
- ? Black list RegExp for class value
- ? Hide before expect
- ? Webdriver host or ip 127.0.0.1
- ? Webdriver port 4444
- ? Browsers list chrome, ie 11
- config.json file saved
- :
- .vscode/launch.json file created
- Start install project dependencies...
- --------------------------------------------
Then specify the file and start recording.
- $ uirecorder sample/test.spec.js
- __ ______ ____ __
- / / / / _/ / __ \___ _________ _________/ /__ _____
- / / / // / / /_/ / _ \/ ___/ __ \/ ___/ __ / _ \/ ___/
- / /_/ // / / _, _/ __/ /__/ /_/ / / / /_/ / __/ /
- \____/___/ /_/ |_|\___/\___/\____/_/ \__,_/\___/_/ v2.5.32
- Official Site: http://uirecorder.com
- ------------------------------------------------------------------
- ? Test spec file name: sample/test.spec.js
- ? Open checker browser? Yes
- ? Browser size (example: 1024 x 768): maximize
- Recorder server listen on: 9765
- Checker browser opened
- ------------------------------------------------------------------
- Recorder browser opened
- url: http://www.moongift.jp/
- ✓ execute succeed
- waitBody:
- ✓ execute succeed
- :
- sendKeys: テスト{ENTER}
- ✓ execute succeed
- waitBody:
- ✓ execute succeed
- ------------------------------------------------------------------
- Record 10 steps, 10 steps check succeed, 0 steps check failed
- Recorded test saved: sample/test.spec.js
- Recorder server closed
- Recorder browser closed
- Checker browser closed
Operation uses Chrome.
After that, I will test by using the web browser. You can also execute JavaScript code.
The source will be created when you perform a single operation. When you do this, the recorded action will be played. The contents of the file are as follows (part).
- $ cat sample/test.spec.js
- :
- module.exports = function(){
- let driver, testVars;
- before(function(){
- let self = this;
- driver = self.driver;
- testVars = self.testVars;
- });
- it('url: http://www.moongift.jp/', async function(){
- await driver.url(_(`http://www.moongift.jp/`));
- });
- it('click: Fruumo - Google Chro... ( #main div:nth-child(3) > div.detail > h2.title > a, 416, 16, 0 )', async function(){
- await driver.sleep(300).wait('#main div:nth-child(3) > div.detail > h2.title > a', 30000)
- .sleep(300).mouseMove(416, 16).click(0);
- });
- it('scrollTo: 0, 0', async function(){
- await driver.scrollTo(0, 0);
- });
- it('click: s ( input[name="s"], 49, 11, 0 )', async function(){
- await driver.sleep(300).wait('input[name="s"]', 30000)
- .sleep(300).mouseMove(49, 11).click(0);
- });
- it('sendKeys: テスト{ENTER}', async function(){
- await driver.sendKeys('テスト{ENTER}');
- });
- };
The code is based on mocha and is generated as testable code. Although the test code is only JavaScript, it is convenient to be able to record the operation in Selenium IDE like GUI. Is not it powerful as substitute software?
UI Recorder is open source software (MIT License) made by node / JavaScript.
No comments:
Post a Comment