Read the alarm on the website

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
leon263
Posts: 3
Joined: 23 Sep 2018, 08:19

Read the alarm on the website

23 Sep 2018, 08:36

Hello.

I'm sorry but English is not my native language.


I am trying to write a script that will react to an alarm on a website. Unfortunately, I can not deal with it.

Code: Select all

<div class = "tv-alert-notification-dialog__subtitle"> alert 1 </ div>
Alarms will have different content depending on the situation, in this case "alert 1".

Then I have to confirm the alarm button by pressing "OK" on the button

Code: Select all

<div class = "js-dialog__action-click js-dialog__no-drag tv-button tv-button - primary" data-name = "ok"> OK </ div>

I tried.

Code: Select all

Contents := wb.document.getElementsByClassName("tv-alert-notification-dialog__subtitle")[0]
MsgBox %Contents%
Unfortunately, no luck.
leon263
Posts: 3
Joined: 23 Sep 2018, 08:19

Re: Read the alarm on the website

24 Sep 2018, 10:11

Can anyone suggest. How could I get a solution?

Part of the page code:

Code: Select all

<div class="tv-dialog__section tv-dialog__section--no-border js-dialog__drag tv-dialog__section--no-padding_bottom tv-dialog__grab ui-draggable-handle">
			<div class="tv-text">
				<p><div class="tv-alert-notification-dialog__head">
			<div class="tv-alert-notification-dialog__icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 51 58" width="51" height="58"><g fill="none"><path fill="#5ec9f4" d="M 29 58 c 3.3 0 6 -3.6 6 -8 H 23 c 0 4.4 2.67 8 6 8 Z m 16.5 -16 V 28.667 c 0 -8.187 -4.51 -15.04 -12.375 -16.854 V 10 c 0 -2.213 -1.843 -4 -4.125 -4 s -4.125 1.787 -4.125 4 v 1.813 C 16.982 13.627 12.5 20.453 12.5 28.667 V 42 L 7 47.333 V 50 h 44 v -2.667 L 45.5 42 Z" /><path stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M 25.72 15.942 c -1.81 0.416 -3.392 1.162 -4.73 2.17 m -2.213 2.177 c -0.12 0.152 -0.237 0.308 -0.35 0.468" /><path stroke="currentColor" stroke-width="4" d="M 24 54 c 3.3 0 6 -3.6 6 -8 H 18 c 0 4.4 2.67 8 6 8 Z m 16.5 -16 V 24.667 c 0 -8.187 -4.51 -15.04 -12.375 -16.854 V 6 c 0 -2.213 -1.843 -4 -4.125 -4 s -4.125 1.787 -4.125 4 v 1.813 C 11.982 9.627 7.5 16.453 7.5 24.667 V 38 L 2 43.333 V 46 h 44 v -2.667 L 40.5 38 Z" /></g></svg></div>
			<div class="tv-alert-notification-dialog__title">Alert on XBTUSD</div>
			<div class="tv-alert-notification-dialog__subtitle">Alert 1</div>
		</div>
		<div class="tv-alert-notification-dialog__message"></div></p>
				</div>
			</div>

Code: Select all

Contents := wb.document.getElementsByClassName("tv-alert-notification-dialog__subtitle")[0]
MsgBox %Contents%
Is this function ok? At the beginning I am trying to display the content in the message box.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Read the alarm on the website

24 Sep 2018, 11:04

getElementsByClassName might be unsupported by ur web browser. u might be better of using css selectors instead:

Code: Select all

MsgBox % wb.document.querySelector(".tv-alert-notification-dialog__subtitle").innerHTML
leon263
Posts: 3
Joined: 23 Sep 2018, 08:19

Re: Read the alarm on the website

24 Sep 2018, 11:17

swagfag wrote:getElementsByClassName might be unsupported by ur web browser. u might be better of using css selectors instead:

Code: Select all

MsgBox % wb.document.querySelector(".tv-alert-notification-dialog__subtitle").innerHTML
Thank you very much for your help. Unfortunately, this solution does not work. I get an empty message box. My browser is IE11.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 236 guests