在試圖提交表單像這樣安裝watir-webdriver
:如何使用Watir獲取js創建的令牌?
https://gist.github.com/f46e8a0ed433fdb16371587920ee4b64
想我可以做到這一點:
require 'watir-webdriver'
b = Watir::Browser.new
b.goto 'URL'
return b.execute_script(validateLoginForm())
不工作。
在試圖提交表單像這樣安裝watir-webdriver
:如何使用Watir獲取js創建的令牌?
https://gist.github.com/f46e8a0ed433fdb16371587920ee4b64
想我可以做到這一點:
require 'watir-webdriver'
b = Watir::Browser.new
b.goto 'URL'
return b.execute_script(validateLoginForm())
不工作。
這可能是一樣簡單:
return b.execute_script("return validateLoginForm()")
好吧,我跟着[這](https://mayxu.wordpress.com/2012/04/17/complete-mac-setup-guide-for-rubycucumberwatirselenium-12/)在Mac上安裝,當我運行你的線火狐意外退出,當我終端中取消命令我得到[this](https://gist.github.com/anonymous/8bd673a1d532f620dd850478d359e632)。 – Forwarding
如何顯示錯誤? – Forwarding
要收集JavaScript錯誤,您需要使用代理或訪問正在測試的頁面的源代碼以添加自定義JavaScript。查看jimevans描述的一種方法使其工作:http://jimevansmusic.blogspot.com/2013/09/capturing-javascript-errors-in.html – titusfortner
然後獲得存儲在cookie或本地/會話存儲的價值?你遇到了什麼錯誤? – titusfortner