How to get the value of a function from a ASP.NET web page with JS as href link using Selenium?

Viewed 52

I'm trying to use the browser automation library Selenium with a Chrome Driver to get the download .asp file which is received after clicking the link.

The Website hosts .aspx files. This is how I get the web page:

//Inside a Javascript function: 
let driver = await new Builder().forBrowser("chrome").build();
await driver.get("https://xxx.xxx.xx.xx/users/Customer.aspx");

This page contains the following element:

<a id="ctl00_main_bttnExportRegister" href="javascript:__doPostBack('ctl00$main$bttnExportRegister','')">Export Register</a>

When this element is clicked, a downloaded.asp file is prompted to download. The downloaded.asp file contains pure HTML.

I don't need to download the file I just want to access the html content that the downloaded.asp provides. How can I achieve this?

Thank you for your help.

0 Answers
Related