Typography

活版印字


  • Home
  • Archive
  • Categories
  • Tags
  •  

© 2020 alincode

Theme Typography by Makito

Proudly published with Hexo

WebdriverIO 常用語法(3)

Posted at 2016-06-12 前端測試  WebdriverIO 

基本條件

  • 已假設你有 Selector 的基本知識
  • 你已經讀過之前在此分享的所有相關文章

Protocol

url

前往特定網址

語法

1
browser.url([url]);

範例

1
browser.url('/login');

實用工具(Utility)

waitForExist

等待一個特定元素出現,才進行下一步。

語法

1
browser.waitForExist(selector);

範例

1
browser.waitForExist('[name=identifier]');

其他相關語法

1
2
3
4
5
waitForEnabled
waitForSelected
waitForText
waitForValue
waitForVisible

pause

暫停一段時間,常用於模擬真人行為減緩測試速度,及方便肉眼檢視每個測試步驟。

語法

1
browser.pause(milliseconds);

範例

1
browser.pause(2000);

Share 

 Previous post: 用 WebdriverIO 寫一個真實世界的登入範例 Next post: WebdriverIO 常用語法(2) 

© 2020 alincode

Theme Typography by Makito

Proudly published with Hexo