简体   繁体   English

将硒代码与F#冠层配合使用

[英]Using Selenium Code with F# Canopy

I am attempting to use Selenium code with F#, I am also using the canopy wrapper. 我正在尝试将Selenium代码与F#一起使用,也正在使用顶篷包装器。 Canopy uses Selenium to make some of it's calls. Canopy使用Selenium拨打电话。

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. 我的问题是我正在努力将Java,C#的Selenium代码转换为F#格式,但互联网上似乎没有太多帮助。

Is anyone able to shed some light on basic conversions. 是否有人能够阐明基本转换。 For example in JavaScript the code to get the title of the webpage is 例如,在JavaScript中,用于获取网页标题的代码为

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

F# doesn't seem to recognize the call 'driver'. F#似乎无法识别呼叫“驱动程序”。 Does anyone have any advice or samples they are able to share. 是否有人可以分享任何建议或样品。

Thanks in advance. 提前致谢。

canopy has support for title built in 机盖支持内置的标题

title() will return the title title()将返回标题

http://lefthandedgoat.github.io/canopy/actions.html 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 要编写与f#中相同的代码,它将是

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM