简体   繁体   中英

button extension in f# canopy

I'm trying to make a general button extension in f# and canopy.

as you know we can click a button like this in canopy

click (//button[contains(text(),'save')])[last()]

But I'm trying to do something like this.

let _button value = sprintf "(//button[contains(text(),'%s')])[last()]" value
let button value = _button value 
click button "save"

but this gives This value is not a function and cannot be applied
Any great ideas?
Thanks in advance

button is a function with signature: string -> string

click is a function with signature: string -> something

So, you cannot pass button to click , you should write:

click (button "save")

or

click <| button "save"

Idiomatically, I would rewrite your code as:

let button = sprintf "(//button[contains(text(),'%s')])[last()]"
click (button "save")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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