how to copy an specific html element code

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
uniadv
Junior Coder
Posts: 29
Joined: Tue Aug 04, 2020 2:16 am

how to copy an specific html element code

Post by uniadv » Fri Oct 02, 2020 6:56 pm

Hi,
I have stuck at place while data-scrapping. I mostly work on google chrome and use "xpath" to perform "ChromeGetElementData" but this time i got data something like this:

HTML of specific element:

Code: Select all

<a class="date js-hide-on-sending js-highlight-link past" dt="2020-10-01T13:22:18.755Z" href="/c/p3iaixpM/193-bagla-hisar#comment-5f75" title="October 1, 2020 7:00 PM">5 hours ago</a>
Here i was extracting date & time by simply using:

Code: Select all

ChromeGetElementData>session_1,strElementID_1,text,strResult
but now instead of getting date & time, i'm getting "5 hours ago" because this website structures has been changed. It seems required data still present within the HTML code of that element i.e. title="October 1, 2020 7:00 PM". So is there any way so i can extract "title" from that element or if not possible then any way to get the whole html code of that particular element?

Regards,
Ushahra

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: how to copy an specific html element code

Post by Marcus Tettmar » Sun Oct 04, 2020 1:06 pm

Try this:

Code: Select all

ChromeGetElementData>session_1,strElementID_1,attribute/title,strResult
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
uniadv
Junior Coder
Posts: 29
Joined: Tue Aug 04, 2020 2:16 am

Re: how to copy an specific html element code

Post by uniadv » Tue Oct 06, 2020 6:36 am

It Worked!
Thank you so much Marcus Tettmar
I'm in love with this software and you too :wink: :wink:

Where can i find its detailed documentation so my every query can be resolved directly from that?
One more thing i want to ask, do i need to start new thread for every query i have or can i continue withing the same thread?


Regards,
Ushahra

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: how to copy an specific html element code

Post by Marcus Tettmar » Tue Oct 06, 2020 6:57 am

The documentation for this command showing how you can specify an HTML attribute is here:
https://www.mjtnet.com/manuals/v15/HTML ... tdata.html

As far as new threads go - best thing would be to keep things on topic. So if it's on the same topic, add to the thread, otherwise create a new one.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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