如何在Browserstack中使用Canopy

时间:2016-01-15 15:13:10

标签: f# canopy-web-testing

我一直是f#测试库Canopy的用户,效果很好。但我无法弄清楚如何在浏览器堆栈上定位浏览器。我确实找到了这个,但它是可能的。

twitter.com/bryan_hunter/status/423352533877153792

1 个答案:

答案 0 :(得分:5)

//Import the required libraries
open canopy
open runner
open System
open OpenQA.Selenium
open OpenQA.Selenium.Remote

//Set the BrowserStack specific capabilities 
let capability = new DesiredCapabilities()
capability.SetCapability("browserstack.user", "username")
capability.SetCapability("browserstack.key", "accesskey")
capability.SetCapability("os", "Windows")
capability.SetCapability("os_version", "7")
capability.SetCapability("browser", "Chrome")
capability.SetCapability("browser_version", "46.0")

//Setup Remote WebDriver to run on BrowserStack
let remote = Remote("http://hub.browserstack.com/wd/hub/", capability)

//Start the browser 
start remote

//Put your tests here

//Run all tests
run()

//close the driver
quit()