Link to home
Start Free TrialLog in
Avatar of Balu G
Balu G

asked on

Search for an attribute value in a HTML page source [extracted from Firefox browser] and make a windows system alert sound

Hello experts,

I am asking to help me with a solution that sifts thru a 'html' code and looks for the value of a specific attribute and that alerts me with a windows notification sound. Let me try and explain what I am doing:
 
1. I want to develop a system that will alert me when a messenger contact goes 'online'. In order to do this, I am using Firefox (v 46.0.1) and I open up the messenger's web app window  [henceforth called Messenger Window] in Firefox.
2. I then select a contact and right click to select "Inspect Element (Q)" from the context menu and the following page opens up [see attachment], henceforth called 'Code Window'.
3. So, in that piece of code, there is a tag [also highlighted in the attachment] that I am interested in.

What I need a code for is to read the whole HTML code and search for the attribute "title" and if its value is "Online", I want my system to beep. But there is also some complication involved I guess - When the contact goes offline [status = invisible], the HTML code does not get refreshed automatically UNLESS, I go to the Messenger Window and come back to the Code Window. So, the possible solution needs to somehow minimize the Code Window and maximize it to fetch the current value of the attribute. This minimize-maximize mechanism needs to happen every 5 secs or so.

Is this doable? This is for my personal use only. I don't intend to make a marketable product out of this. So, I hope there are no legal implications involved.
PageSource.jpg
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

What is the URL for the PageSource display?  I think we want to check and see if the span is really part of the HTML document, or if it's injected into the DOM by JavaScript.  If it's part of the HTML, and if the document is getting refreshed regularly, I can envision a web application that can read and reread the HTML document, parse out the information you want and send some kind of alert.
Avatar of Balu G
Balu G

ASKER

Well, it is:

https://web.whatsapp.com.

I am betting that the tags in question are injected into the DOM by JS. Because, if I just extracted HTML from that webpage, I don't see any information.
Avatar of Balu G

ASKER

Alternatively, can I have a code to click, using coordinates, on the browser page [manually opening up https://web.whatsapp.com and clicking the contact I want to track] and right click to "Inspect element" and then grab the code off there? Because that specific element ["title=online"] is only available when I do the "Inspect element".
Avatar of Balu G

ASKER

OOh... one last thing - that URL won't work with IE. It is only compatible with FireFox, Chrome, Edge among a couple of other browsers.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Balu G

ASKER

Thank you, Ray. I am afraid you are correct and I don't think WhatsApp has an open source API. I will wait for another day or two to see if anyone has anything more to offer. If not, I will accept your last response as the best response.

Cheers,
Jay
Avatar of Balu G

ASKER

Thank you!