Friday 27 September 2019

There has to be an easier way to do what I'm trying to do..

So I'm working on an automation project for work, and powershell (Invoke-WebRequest) wasn't cutting it due to lots of security settings on our internal sites.so I switched over to Puppeteer for the browser automation piece - very new to JS and puppeteer, pretty much learning as I go.Have most of the script completed and working, and it does work as is, but I'm thinking there is a way to make it easier.It really just logs into our site, clicks a few buttons, and then fills in the form to create a new user, which includes some text boxes and a few dropdowns.They coded these websites in kind of a shitty way, and on this user creation page, I can't get any clicks to actually work because Puppeteer doesn't like the selectors of any of the fields.got around this by just tabbing through the different fields and then typing the info.the issue then is the dropdowns.a few of these dropdowns have 50-100 different options and any one of them could potentially be used.so right now, it works, but it includes a shitload of these:await page.keyboard.press('ArrowDown'); We're talking 1000 lines just for one dropdown.I'm thinking there has to be an easier way to simulate a ton of these in a row.I don't want my script to actually list 75 of these lines when I want to arrow down to a specific item in the dropdown.I have another script that uses {clickCount: #} to simulate repeated clicks, but I can't find anything similar that works for presses.anyone have any ideas?

Submitted September 27, 2019 at 03:04PM by GreekNord

No comments:

Post a Comment