将硒代码与F#冠层配合使用 [英] Using Selenium Code with F# Canopy

查看:67
本文介绍了将硒代码与F#冠层配合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Selenium代码与F#一起使用,也正在使用顶篷包装器. Canopy使用Selenium拨打电话.

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.

我的问题是我正在努力将Java,C#中的Selenium代码转换为F#格式,但在Internet上似乎没有太多帮助.

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.

任何人都可以对基本转换有所了解.例如,在JavaScript中,用于获取网页标题的代码是

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#似乎无法识别呼叫驱动程序".是否有人可以分享任何建议或样品.

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

谢谢.

推荐答案

机盖支持内置的标题

title()将返回标题

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

浏览器中等同于机盖驱动程序,它为您提供了当前活动的浏览器/驱动程序.

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

要编写与f#中相同的代码,

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

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

这篇关于将硒代码与F#冠层配合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆