Edge equivalent for IEExtractTable

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
spar108r
Newbie
Posts: 13
Joined: Tue Oct 24, 2006 12:10 am
Location: Toronto, Ontario, Canada

Edge equivalent for IEExtractTable

Post by spar108r » Thu Mar 16, 2023 4:17 pm

Hi,

With Microsoft planning on decommissioning IE11 from windows for good, I'm busy trying to convert some existing scripts to use Edge browser instead.

I need to Extract a table from the web page to a csv file, which is being done successfully currently via the IEExtractTable command.

Is there a similar functionality I can achieve via the Edge commands ?

Thanks,

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

Re: Edge equivalent for IEExtractTable

Post by Dorian (MJT support) » Thu Mar 16, 2023 4:52 pm

Hi,

No there isn't.

You'll need to extract the table tag (or if more convenient tr or td tag) and parse out the data yourself.
Yes, we have a Custom Scripting Service. Message me or go here

spar108r
Newbie
Posts: 13
Joined: Tue Oct 24, 2006 12:10 am
Location: Toronto, Ontario, Canada

Re: Edge equivalent for IEExtractTable

Post by spar108r » Thu Mar 16, 2023 11:34 pm

Thanks for confirming Dorian!

Also for IE, macro scheduler had IEFormFill, which I was using to fill in read only input fields like date fields mapped to javascript mini calendars (to avoid manipulating the pop-up window for desired date) as well as dropdown inputs by setting the index of the select input.

I couldn't achieve similar functionality utilizing EdgeFindElements/EdgeSetElementValue

How can I set the read only inputs and select input to the desired value that I'm currently doing with IEFormFill?

Thanks again,

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

Re: Edge equivalent for IEExtractTable

Post by Dorian (MJT support) » Fri Mar 17, 2023 10:17 am

Datepickers tend to vary, so often one solution won't fit another. However, taking the following one as an example, we can use xpath to enter the date without needing the pop-up. Hopefully this may get you started.

//Datepicker HTML

Code: Select all

<!DOCTYPE html>
<html>
<head>
	<style>				
		body {
			text-align: center;
		}
	</style>
</head>
<body>
	<h2 style="color:green">GeeksforGeeks</h1>
	<b> How to add a datepicker in form using HTML
	</b>
	<br>
	<h4>Date Of Birth:
	<input type="datetime-local" id="Test_DatetimeLocal">
	</h4>
</body>
</html>					
//Macro Scheduler code :

Code: Select all

//<input type="datetime-local" id="Test_DatetimeLocal">
//DD/MM/YYYY
EdgeFindElements>session_id,xpath,//input[@id='Test_DatetimeLocal'],el
EdgeSetElementValue>session_id,el_1,20/12/2023
For select/option, index is no longer an option, but there is a workaround of sorts.



Below are two ways of selection options :

Code: Select all

<select id="sel">
<option value="123" selected="selected">text1</option>
<option value="44">text2</option>
<option value="882">text3</option>
</select>

This would select the third option :

Code: Select all

Let>strXPATH=//select[@id='sel']//descendant::option
EdgeFindElements>session_id,xpath,strXPATH,strElementID
EdgeElementAction>session_id,strElementID_3,click
Other than that we can use these two methods :
Option 1:

Code: Select all

EdgeFindElements>session_id,xpath,//select[@id='sel'],el
EdgeSetElementValue>session_id,el_1,text3
Option 2:

Code: Select all

EdgeFindElements>session_id,xpath,//option[@value='882'],el
EdgeElementAction>session_id,el_1,click
Yes, we have a Custom Scripting Service. Message me or go here

spar108r
Newbie
Posts: 13
Joined: Tue Oct 24, 2006 12:10 am
Location: Toronto, Ontario, Canada

Re: Edge equivalent for IEExtractTable

Post by spar108r » Fri Mar 17, 2023 2:31 pm

Thanks Dorian, setting the select input via the Option #1 you provided worked perfectly !

However, in the case of the input type "text" readonly fields, I'm unable to set their values to valid date with EdgeSetEelementValue like I did before utilizing IEFormFill.

Code: Select all

<input type="text" name="startDate" readonly>
If this helps, this is how the embedded javascript code function currently sets the readonly value to the popup calendar selected value :

Code: Select all

document.forms["searchRequestForm"]["startDate"].value = dateStr
What else can I do to get these fields populated ?

Thanks once again :)

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

Re: Edge equivalent for IEExtractTable

Post by Dorian (MJT support) » Fri Mar 17, 2023 4:05 pm

I've been testing quite exhaustively this afternoon and I'm wondering if it's simply that the Edge/Chrome commands "obey" readonly but the IE commands don't.

In all honesty that's getting beyond my level of experience, so I will ask Marcus to weigh in / confirm.
Yes, we have a Custom Scripting Service. Message me or go here

spar108r
Newbie
Posts: 13
Joined: Tue Oct 24, 2006 12:10 am
Location: Toronto, Ontario, Canada

Re: Edge equivalent for IEExtractTable

Post by spar108r » Fri Mar 17, 2023 9:03 pm

Thanks again Dorian, appreciate the due diligence!

From the Edge Browser itself, it allows me to manually execute the following from the Dev Tools Console window and it sets the input text readonly fields successfully:

Code: Select all

document.forms["searchRequestForm"]["startDate"].value="3/19/2023";
I noticed Chrome has the added command of ChromeExecute which Edge does not have. Unfortunately I cannot use Chrome as my browser for the script due to the updates frequency of Chrome and having to download the latest chromedriver.exe every time to match the Chrome Browser GUI. For Edge on the other hand, my company manages the updates, so the updates aren't as frequent.

Is there some way then now to call custom javascript code injected via the Edge Browser session ?

Many Thanks,

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

Re: Edge equivalent for IEExtractTable

Post by Dorian (MJT support) » Fri Mar 17, 2023 11:52 pm

I tested the following :

Code: Select all

ChromeExecute>session_id,document.forms["searchRequestForm"]["startDate"].value="3/19/2023";
And it did indeed enter the date. There is not currently an EdgeExecute command. Let's see what Marcus has to say about that as a possibility. I would think that if it was a possibility, he would have added it when adding ChromeExecute.
Yes, we have a Custom Scripting Service. Message me or go here

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