I recently started using Coypu to automate some task with a Web Browser. It works great, especially when filling out forms and navigating links.
Now, I am attempting to work with the table data. I actually want to take the table data and eventually dump it to a pipe-separated text file.
However, I have reach my limitations with Coypu and navigating through table rows and columns. However, there are several examples of how to read tables into data collections.
Once I reach a certain point I want to take the Coypu objects and morph them into Selenium objects so that I can do the table work, but I can't seem to be able to get this out of Coypu.
Here is the test code: Console.WriteLine("TestMethod1()");
IWebDriver webDriver = null;
var sessionConfiguration = new SessionConfiguration()
{
Browser = Coypu.Drivers.Browser.Firefox,
AppHost = "http://blabla.com"
};
var browser = new BrowserSession(sessionConfiguration);
browser.Visit("/searches/index");
// Set the start date
browser.FillIn("sdate").With("01/01/2018");
// Set the end date
browser.FillIn("edate").With("12/30/2018");
// Set the city
browser.FindId("city").SelectOption("Chicago");
// Click on submit
browser.ClickButton("Submit");
// Get the table with data
var innerHTML = browser.FindCss("table#dataTable").InnerHTML;
Coypu.Drivers.Selenium.SeleniumWebDriver
//webDriver = (OpenQA.Selenium.IWebDriver)browser.Driver;
//IWebElement curTable = (IWebElement)browser.FindCss("table#dataTable").OuterHTML;
//TablePage page = new TablePage(webDriver);
//Utilities.ReadTable(page.Table);
Console.WriteLine( Utilities.ReadCell("Marker", 1) );
My questions are the following:
- How do I extract the Selenium IWebDriver from Coypu BrowserSession?
- How do I extract out the table I want from Coypu and make it a Selenium IWebElement?