I'm trying to scrape the links from the following site with C#, phantomjs and Selenium. It uses a login popup form which is triggered from a login link. When I execute the code below the popup is displayed correctly in the saved image but the DOM is not updated in the driver.PageSource line. The popup shows a username and password field where the username input has an element id of iptvauth_field_username.
Is there a way to get the latest html that is outputted after triggering the javascript that changes the DOM? this seems like such a trivial thing to do, all the examples online are very basic and don't cover this.
these are my nuget packages
PhantomJS version="2.1.1"
phantomjs.exe version="1.9.2.1"
Selenium.WebDriver version="2.52.0"
var driver = new PhantomJSDriver();
driver.Url = "http://www.ufc.tv/";
driver.Navigate();
var source = driver.PageSource;
var loginLink = driver.FindElementByLinkText("Sign In");
loginLink.Click();
Screenshot sh = driver.GetScreenshot(); // shows popup
sh.SaveAsFile(@"d:\Temp.jpg", ImageFormat.Png);
var username = driver.FindElementById("iptvauth_field_username"); // does not exist
source = driver.PageSource; // does not show popup in