Help clicking a webpage button

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Help clicking a webpage button

Post by madcyborg » Sun Mar 07, 2021 4:18 pm

Hi,

I'm working on my smart home this morning, and I have ~150 applets in my IFTTT account. There is some weird behavior where my Google home smart speaker "forgets" commands, and you have to click the "Check Now." Now, having 150 or so applets, I can't be bothered, so I would like to automate this process so I can run it once a week.

Here is the browser code when I inspect the source for the page:

Code: Select all

<a class="btn-sm btn-outlined btn" data-track-ifttt-next-event="click" data-track-data="{&quot;object_type&quot;:&quot;connection_activity_check_now&quot;,&quot;object_id&quot;:&quot;SAMPLEID&quot;,&quot;location_type&quot;:&quot;connection_config&quot;}">Check now</a>
SAMPLEID changes for every single applet. My code so far is:

Code: Select all

IEGetFromURL>https://ifttt.com/applets/SAMPLEID,IE_Inst
IEClickTag>IE_Inst,,,A,btn-sm btn-outlined btn,Check now,result
I don't have a lot of working code in this area, but I want to get better at it. I have done some really cool things with the software but not with the browser yet. Does anyone have an idea on how to fix this?

PS: I also have an Alexa, for other automation purposes, for all you smart speaker partisans :P

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Help clicking a webpage button

Post by Dorian (MJT support) » Sun Mar 07, 2021 7:21 pm

I'd have thought either of these would work :

Code: Select all

IECreate>IE_Inst
IENavigate>IE_Inst,https://ifttt.com/applets/SAMPLEID,res

IETagEventByAttrib>https://ifttt.com/applets/SAMPLEID,A,classname=btn-sm btn-outlined btn,click,
IETagEventByAttrib>https://ifttt.com/applets/SAMPLEID,A,innertext=Check now,click,

Yes, we have a Custom Scripting Service. Message me or go here

madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Re: Help clicking a webpage button

Post by madcyborg » Sun Mar 07, 2021 9:50 pm

It tries to use Internet Explorer, which IFTTT says is an incompatible browser. It also tries to open Microsoft Edge. As someone new to the browser automation, what is the recommended behavior here?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Help clicking a webpage button

Post by Dorian (MJT support) » Mon Mar 08, 2021 10:56 am

I went with your lead using IE as your snippet was using an IE function. Let's try it in Chrome.

Before running this script, you'll need to download the appropriate Chromedriver. I strongly suggest reading this article before doing so.

Code: Select all

Let>CHROMEDRIVER_EXE=c:\chromedriver.exe
let>TheURL=https://ifttt.com/applets/SAMPLEID

ChromeStart>session_id
ChromeNavigate>session_id,url,%TheURL%

ChromeFindElements>session_id,xpath,//a[@class='btn-sm btn-outlined btn'],el
ChromeElementAction>session_id,el_1,click
If you experience the "Unquoted string in JSON data only valid for dictionary names" error this means you've downloaded the wrong version of Chromedriver. This will help.
Yes, we have a Custom Scripting Service. Message me or go here

madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Re: Help clicking a webpage button

Post by madcyborg » Tue Mar 09, 2021 1:22 pm

Looks like I have to upgrade.

1 x Macro Scheduler Pro 1 User (Non-Business)

Is there an upgrade for those with version 14 or is it just year-over-year?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Help clicking a webpage button

Post by Dorian (MJT support) » Tue Mar 09, 2021 1:26 pm

If you log in to your user area you should see an upgrade link over to the right. If you still had active Maintenance at the time Macro Scheduler 15 was released you'll have access to v15.
Yes, we have a Custom Scripting Service. Message me or go here

madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Re: Help clicking a webpage button

Post by madcyborg » Wed Mar 10, 2021 3:03 am

Code: Select all

DevTools listening on ws://127.0.0.1:55582/devtools/browser/7f9d956a-aa74-4376-b58e-f0632063f98f
[3216:19036:0309/220154.939:ERROR:device_event_log_impl.cc(211)] [22:01:54.938] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[3216:19036:0309/220156.186:ERROR:device_event_log_impl.cc(211)] [22:01:56.185] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[3216:19036:0309/220156.195:ERROR:device_event_log_impl.cc(211)] [22:01:56.194] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[3216:19036:0309/220156.198:ERROR:device_event_log_impl.cc(211)] [22:01:56.197] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Still working on it… No success yet.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Help clicking a webpage button

Post by Dorian (MJT support) » Wed Mar 10, 2021 11:15 am

I know very little about IFTTT (nothing, in fact). This might be a good starting point. It looks like you're not alone in this issue.
Yes, we have a Custom Scripting Service. Message me or go here

madcyborg
Newbie
Posts: 12
Joined: Sun Oct 20, 2019 3:22 pm

Re: Help clicking a webpage button

Post by madcyborg » Thu Mar 11, 2021 1:55 am

Well well, I got something to work! :D This is neat. For the person who tries to read this in the future, the fix is to make sure your browser is updated to the same version as the chromedriver. I still get all of those errors spamming to the console, but they appear to be harmless, overeager warnings.

Code: Select all

Let>CHROMEDRIVER_EXE=my_location:\chromedriver.exe
let>TheURL=https://ifttt.com/login
ChromeStart>session_id
ChromeNavigate>session_id,url,%TheURL%
ChromeFindElements>session_id,partial link text,Continue with Google,el
ChromeElementAction>session_id,el_1,click
Not too bad, once you get started. Thanks Dorian.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts