[Protractor] Protractor Interactive with elementor

本文介绍了如何安装并使用Protractor进行网页UI自动化测试的方法。包括安装配置、启动WebDriver Manager、测试页面元素定位及操作等步骤。同时展示了如何通过WebStorm插件提高测试效率。

Install:

npm install -g elementor

 

Then run:

webdriver-manager start

 

Lets say if we want to test 'http://angular.github.io/protractor/#/api' page:

elementor http://angular.github.io/protractor/#/api

 

Notice: close the chrome debug tool first! Otherwise protractor cannot run!

 

  • When the page open, right click the tab, choose duplicate!
  • Choose the second tab, open the chrome debugger tool
  • In debugger tool, in elements tab, inspet one element, see the protractor tab:

The number "1" you see here indicate that there is only 1 element match hte locators. 

 

 

Let's select:

by.css("#searchInput")

 

  • Go to the first window, click the extension tool:

  • Type what you want in the search input:

Then you can find the element you want.

 

  • You can use 'sendKeys()' function to trigger seach:
element.all(by.css("#searchInput")).sendKeys("filter")

 

  • You can use 'clear()' function to clean the input:
element.all(by.css("#searchInput")).clear()

 

---------------------------------

 

You can also use webstorm plugin for testing. Install the 'elementor' plugin.

When imaging you are doing some unit testing.

 

You can select the code you want, right click, in the pop menu select 'Test selected locator'.

转载于:https://www.cnblogs.com/Answer1215/p/5199698.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值