frankcollins3 / Node-Alerts

apparently Node doesn't have alerts. This app will invoke func from Node environment. connect Node with C or other to alert user
0 stars 0 forks source link

w3 schools JS compiler: <iframe> not so easy to access for [jq | js] targeting [12:29pm] #2

Open frankcollins3 opened 1 year ago

frankcollins3 commented 1 year ago

Screen Shot 2023-05-15 at 12 13 25 PM

take this code here:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: false });
  const page = await browser.newPage();
  await page.goto('https://www.w3schools.com/tryit/tryit.asp?filename=tryhtml_hello');

  // Switch to the iframe that contains the code editor
  const iframe = await page.frames()[1];

  // Insert the desired code into the editor
  await iframe.type('#textareaCode', `
    <!DOCTYPE html>
    <html>
    <body>

    <h1 style="background-color: red;">Hello World!</h1>
    <p>This is a paragraph.</p>

    </body>
    </html>

    <script>
      **alert('hey');**
    </script>
  `);

  await browser.close();
})();

the invocation of alert('hey') is supposedly the code that could bypass the need for a C/python prompt. C isn't built with browser in mind so doesn't have those properties/methods built in. With puppeteer, I realized if we could take input on whatever text would go into the alert() method:

We could essentially built a very basic Pomodoro-Session app that would receive user-specified input on: 1) how long the session will be 2) any key concepts or learnings worth storing to a db or other method of saving data. storing data could be facilitated:

first proposed approach: find the id or class of [run] to target with .click()

Screen Shot 2023-05-15 at 12 47 55 PM

Screen Shot 2023-05-15 at 12 49 11 PM

found the button: Screen Shot 2023-05-15 at 12 52 43 PM

[12:53pm]

frankcollins3 commented 1 year ago

puppeteer: (GraphQL RootQueryType key) Screen Shot 2023-05-15 at 1 30 14 PM

{message: 'Navigation timeout of 30000 ms exceeded',

this looks to be the error blocking the running of code.

[1:31pm]

frankcollins3 commented 1 year ago

proposed approach:

Screen Shot 2023-05-15 at 1 40 34 PM

Screen Shot 2023-05-15 at 2 39 57 PM

separate concerns and step away from the