0

It is just that, I have a button that opens the website, but I can't figure out how to fill that field on that website and search for the String that I'm providing. I really don't know where to look for this.

Right now, I open the website with :window.open(url); but that's it.

Using console, I can fill the txtInput using this $('#txtBuscar').val('geo');

Then click the button with this: $('#btnBuscar').click();

But I don't know how to do this from my function... Any ideas on what to use?

Website is https://www.mercadopublico.cl/Home

Cœur
  • 37,241
  • 25
  • 195
  • 267

3 Answers3

0

I think you can't do that. Because when you use window.open(url); the browser opens a new window with url, but you script will be running in the previous window.

thstamod
  • 174
  • 1
  • 8
0

You could have the new site open up in an iframe on your page and then navigate the dom with your pages javaScript.

hajile78
  • 167
  • 1
  • 7
0

You cannot do this without getting a Cross-Origin Resource Sharing (CORS) error.

Unless the site you are accessing allows it, you cannot access the code.

See How does Access-Control-Allow-Origin header work? for a full explanation.

Steve Padmore
  • 1,710
  • 1
  • 12
  • 18