Using Selenium Code with F# Canopy

Deadly 提交于 2019-12-11 03:04:37

问题


I am attempting to use Selenium code with F#, I am also using the canopy wrapper. Canopy uses Selenium to make some of it's calls.

My issue is I am struggling to covert Selenium code from Java, C# into an F# format, there doesn't seem to be much help on the internet.

Is anyone able to shed some light on basic conversions. For example in JavaScript the code to get the title of the webpage is

driver.getTitle().then(function(title) {
  console.log('Page title is: ' + title);
}); 

F# doesn't seem to recognize the call 'driver'. Does anyone have any advice or samples they are able to share.

Thanks in advance.


回答1:


canopy has support for title built in

title() will return the title

http://lefthandedgoat.github.io/canopy/actions.html

The equivalent of driver in canopy is browser, which gives you the current active browser/driver.

To write the same code you have in f# it would be

printfn "Page title is: %s" title()



来源:https://stackoverflow.com/questions/22678029/using-selenium-code-with-f-canopy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!