skip to Main Content

I would like to know if it is possible to retrieve the html code of a site after having executed a function,

let me explain :

I would like to retrieve the link of a source of an iFrame element but this element only appears when I execute a function in the console. I deduced that this function generates this iframe with the link I want to retrieve. However I want to do it only via requests, I mean I don’t want to retrieve it manually but rather automatically. I tried to reproduce this famous function but I did not succeed.

Basically I don’t own this site and need some source from an iframe. this iframe element with a certain source is generated through a function. So I can call this function in the google console and it generates the iframe for me with the right source but the problem is that jou would like to do this but automatically and not manually.

Here is what I got at the start when I just load the page

Then I enter this function in the google console

Then I get this iframe which has a link, the link I want to retrieve However I would like to perform this action dynamically via a js script and not do it manually

Thank you for your cordial response.

EDIT : after a few answers, here is the right question : How could I call a function on an external site that is not mine?

2

Answers


  1. Chosen as BEST ANSWER

    Selenium with python, here is my solution.. ;)


  2. Can’t you just change the src of your ifram ?

    function myFunction() {
        document.getElementById('customIFrame').src = "https://www.google.com"
    }
    <iframe id="customIFrame" src=""></iframe>
    <button type="button" onclick="myFunction()">CLICK ME!</button>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search