For example, I have this simple replicate of a webpage (in reality the code is not mine and I am not in control of that):
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<button>Click me!</button>
<script>
document.querySelector("button").addEventListener("click", () => {
const txt = document.createElement("input");
txt.type = "file";
txt.addEventListener("change", () => {
console.log(txt.files[0]);
});
txt.click();
});
</script>
</body>
</html>
As you can see, all we see is a button. When the button is clicked, it creates an input and activates it without ever attach it to the HTML document.
Please advise how do I automate in this case (i.e click the button, choose a file). I am using C# .NET if it's relevant but I think a general direction is okay.