0

I've utilized the following links for reference, but still cannot get my code to print the HTML

<title>This is the title</title>

Using Selenium Code with F# Canopy

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

The following 3 lines of code do not print what I am expecting (I am attempting C# at the end as another way to do this). What I had expected this to do, was extract the TITLE from my HTML file and print it to the console window. I do not have a "purpose" for this yet, but I was just testing all of the actions available in the documentation.

let theTitle = title()
printfn "Page title is: %s" title()
System.Console.WriteLine("Print the title here: {0}", theTitle);
Community
  • 1
  • 1
Brien Foss
  • 3,336
  • 3
  • 21
  • 31

1 Answers1

1

With this code:

let title() = @"<title>This is the title</title>"
printfn "Page title is: %s" (title())
Page title is: <title>This is the title</title>

I get the expected result. Due to F# type inference restrictions, you need to use a pair of brackets around title().

John Palmer
  • 25,356
  • 3
  • 48
  • 67
  • Thank you for the answer. I have applied this and it does in fact print to the console window. I have also edited my question with details on what I was expecting. – Brien Foss Jun 06 '14 at 20:50