I’m new to n8n but have had a fair bit of exposure to the likes of Make, Pabbly and Zapier.
I’m not a coder, and despite trying for days reading API docs for ScreenshotOne.com and Browserless.io and using chatGPT etc, I’m really struggling with a puppeteering action and I’d appreciate any assistance, please.
This is an attempt to learn what I thought was a somewhat basic puppeteering task before tackling something larger and more useful. I got as far as taking a screenshot, but as soon as I tried to write JSON script it keeps failing despite many variations calling screenshot, function and content API’s.
navigate to address field #bin-collection-address-search
enter an address
10 allamanda street, mount
wait a few seconds for page to reload
select the first address suggested in the drop-down menu #prediction-results > button:nth-child(1)
screenshot and scrape the text from box that appears below #common-bin-collection-calendar-tool > app_common-bin-collection-calendar-tool > div > div > div:nth-child(2) > div
I’m very open to using another service if anybody can assist in any way, please.
This is currently setup to run at 4pm every Monday, but ideally I’d love this to run daily, look at the date from the data scrape and send the day prior. Obviously though, I need to scrape that data to get that first however
If your goal is to retrieve the data despite the screenshot, I would personally start by mimicking user behavior and monitoring HTTP requests to obtain the necessary data.
I noticed that this website sends two requests: one to retrieve the correct address format via Google APIs and the other to fetch the required data through the website’s API.
Although it’s possible to use Browserless, I would avoid unnecessary complications, connecting to other services, and dealing with high latency if the goal is to obtain the data as mentioned.
This approach directly retrieves the data without relying on external services, simply by making HTTP requests and correctly parsing the data to ensure compatibility with the website’s API inputs.
The parsing logic in the Code node is taken from the website’s JavaScript source codes for your information.
Here’s a working example. Feel free to edit it to suit your needs.
Thank you for taking the time to look into the construct of how the process works and to provide a solution. As a non-technical person, I am not sure how you figured this out; this process is clearly showing my need to up-skill in this area and also change my way of approaching these problems.
I was adept enough to place a timer trigger at the start, convert the date format and send the output via Twilio, so I’m not completely useless .
The output shows the next bin day date, however it does not show what type of bins are collected on that day. Is this extract possible using this method, please?
Do you have any recommendations for obtaining the screenshot of the specific part of the page showing the bin date and type of bins, please?
In your use case, this isn’t static data you can grab from a URL and screenshot it, you’re interacting with the site (typing text, waiting, clicking, etc.). As you mentioned, you’ll need browser automation (Browserless, Puppeteer).
⚡
If this answers your question, Kindly mark the reply as the solution so others with the same issue can find it easily
Thanks so much @mohamed3nan, I really appreciate all your help.
Is this reverse engineering approach something that can explained to a non-coder such as myself, or do I just move on, take your word for it and figure that out later? I am trying to learn, however I do accept that some things are beyond me at this point in time.
I really appreciate your time and assistance, thank you. You’ve really helped me re-frame how I approach these opportunities.
Actually, the “reverse engineering” approach took me a bit of time. I inspected the website requests, then dug into the logic within the static files, I’ll admit, I also used an AI assistant to help find what I was looking for, so it’s definitely not something intended for non-coders, and that’s totally fine. I was just curious and found myself trying to make it work
For a no-code user, as you mentioned earlier, you’d likely need browser automation tools like Browserless or Puppeteer, which do require a bit of coding, especially to handle the kind of interactions you’re aiming for…
I’d encourage you to give it a try, start by installing them and experimenting…
You’ll definitely learn a lot of cool stuff along the way!