Inserting/pasting text into a table

Discussions and Tech Support specific to the iMacros for Chrome extension.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Graysonn
Posts: 3
Joined: Wed Aug 30, 2017 12:21 pm

Inserting/pasting text into a table

Post by Graysonn » Wed Aug 30, 2017 12:56 pm

Hi, I hope you can help and I hope this is in the correct forum.

I'm trying to use iMacros for Chrome to automate a repetitive task.

The task involves opening a Jira ticket and pasting/instering information back and forth between the jira ticket and a confluence webpage.

I've got most of it done but I'm having difficulty with the last part.

I have to paste/insert ticket numbers into a table. It's a simple 2 row, 4 column table. The top row is the column names.
I have the ticket numbers stored as variables. I can get them to be inserted into a text box. However I can't seem to manage the table.

The table class is confluenceTable. It doesn't have an ID and there's no way to add an ID in confluence. Additionally, there are multiple tables on this page, they all have the same class.


So it looks like this

Code: Select all

<table class="confluenceTable"> 
<colgroup>Stuff about the size and width of the cells</colgroup>
<tr> 
<th class="confluenceTh"> Column Name </th>   <--- There's 4 of these
</tr>
<tr>
<td class="confluenceTd">Empty cell I want to put text into</td>   <--- There's 4 of these
</tr>
</table> 

Any idea how I paste into those cells?


Editing to add:

1. What version of iMacros are you using?
You find the iMacros version and build information at the top of every macro that you record, for example "VERSION BUILD=10100795". Please test with the latest version.
VERSION BUILD=844


2. What operating system are you using? (please also specify language)
Windows 7

3. Which browser(s) are you using? (include version numbers)
Chrome Version 60.0.3112.113

4. Do the included demo macros work ok?
Yes.

5. If reporting a problem with the Scripting Interface, please also test if the included VBS sample scripts run ok.
This test helps us to determine if the iMacros Scripting Interface installation is ok.

N/A

6. If recording or replay fails on a specific website: Can you please post the URL of the web page and/or the imacro that creates the problem? If you can not post the imacro or login data in the public user forum, please email it to support AT iopus DOT com and mention your forum post in the email.
Internal website. can't post a link.

7. Do you encounter the same problem with the iMacros Browser, iMacros for Internet Explorer and iMacros for Firefox? Note: If your question is specifically about iMacros for Firefox or iMacros for Chrome, please use their sub-forums.
I'd imagine I would since I can't get it to identify a particular part of a webpage.

I have a script that works up to this point. The issue is identifying the table itself.
I'm trying variations on

Code: Select all

TAG POS=1 TYPE=td ATTR=CLASS:confluenceTd CONTENT=Test
but I keep getting an error like "RuntimeError: element TD specified by CLASS:confluenceTd was not found, line: 9"

Since it's an internal site I can't provide too much detail but I thought if I provided the code for the table someone might be able to point out where I'm going wrong.

I've been googling like mad and I've found plenty of information on how to extract data from tables and I've been trying to replicate that but it's not working (I figured if I could extract data then I've got the right location and it meant I could easilly input data).
Last edited by Graysonn on Wed Aug 30, 2017 2:07 pm, edited 2 times in total.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Inserting/pasting text into a table

Post by chivracq » Wed Aug 30, 2017 1:35 pm

Graysonn wrote:Hi, I hope you can help and I hope this is in the correct forum.

I'm trying to use iMacros for Chrome to automate a repetitive task.

The task involves opening a Jira ticket and pasting/instering information back and forth between the jira ticket and a confluence webpage.

I've got most of it done but I'm having difficulty with the last part.

I have to paste/insert ticket numbers into a table. It's a simple 2 row, 4 column table. The top row is the column names.
I have the ticket numbers stored as variables. I can get them to be inserted into a text box. However I can't seem to manage the table.

The table class is confluenceTable. It doesn't have an ID and there's no way to add an ID in confluence. Additionally, there are multiple tables on this page, they all have the same class.

So it looks like this

Code: Select all

<table class="confluenceTable"> 
<colgroup>Stuff about the size and width of the cells</colgroup>
<tr> 
<th class="confluenceTh"> Column Name </th>   <--- There's 4 of these
</tr>
<tr>
<td class="confluenceTd">Empty cell I want to put text into</td>   <--- There's 4 of these
</tr>
</table> 
Any idea how I paste into those cells?
(F)CIM...! :mrgreen: (Read my Sig...)

"... and I hope this is in the correct forum."
=> Well, nope it isn't, especially if you don't mention your FCI... The 'iMacros for CR' Sub-Forum is meant for Scripts that work in other Browsers but fail in CR only... (Correct Sub-Forum would have been the 'General' one... But OK, no need to duplicate now...)

But OK, mention your FCI for me to have a look at your Case, but no Script/URL posted = only generic Advice... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Graysonn
Posts: 3
Joined: Wed Aug 30, 2017 12:21 pm

Re: Inserting/pasting text into a table

Post by Graysonn » Wed Aug 30, 2017 2:06 pm

I've updated my post to include additional information.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Inserting/pasting text into a table

Post by chivracq » Wed Aug 30, 2017 2:38 pm

Graysonn wrote:I've updated my post to include additional information.
OK, very good... :D

Quoting only the "new" Info...:
Graysonn wrote:Editing to add:

1. What version of iMacros are you using?
You find the iMacros version and build information at the top of every macro that you record, for example "VERSION BUILD=10100795". Please test with the latest version.
VERSION BUILD=844

2. What operating system are you using? (please also specify language)
Windows 7

3. Which browser(s) are you using? (include version numbers)
Chrome Version 60.0.3112.113

4. Do the included demo macros work ok?
Yes.

5. If reporting a problem with the Scripting Interface, please also test if the included VBS sample scripts run ok.
This test helps us to determine if the iMacros Scripting Interface installation is ok.
N/A

6. If recording or replay fails on a specific website: Can you please post the URL of the web page and/or the imacro that creates the problem? If you can not post the imacro or login data in the public user forum, please email it to support AT iopus DOT com and mention your forum post in the email.
Internal website. can't post a link.

7. Do you encounter the same problem with the iMacros Browser, iMacros for Internet Explorer and iMacros for Firefox? Note: If your question is specifically about iMacros for Firefox or iMacros for Chrome, please use their sub-forums.
I'd imagine I would since I can't get it to identify a particular part of a webpage.

I have a script that works up to this point. The issue is identifying the table itself.
I'm trying variations on

Code: Select all

TAG POS=1 TYPE=td ATTR=CLASS:confluenceTd CONTENT=Test
but I keep getting an error like "RuntimeError: element TD specified by CLASS:confluenceTd was not found, line: 9"

Since it's an internal site I can't provide too much detail but I thought if I provided the code for the table someone might be able to point out where I'm going wrong.

I've been googling like mad and I've found plenty of information on how to extract data from tables and I've been trying to replicate that but it's not working (I figured if I could extract data then I've got the right location and it meant I could easilly input data).
OK, for the "FCI" part, you can usually use this simplified Format:

Code: Select all

iMacros for CR v8.4.4, CR60, Win7-x32/x64.
OK, you are sure iMacros recorded "TYPE=td" with "td" in lowercase...? One Browser is Case Sensitive or rather "forced Case Insensitive" and expects 'TYPE' and Attributes in Uppercase...

But hum, a 'TD' HTML Field in a Table is for "Display" (=> tagging or extracting) and not for "Input", I would think...
Are you sure iMacros really records this Statement if you fill in this Field with "Test"...?:

Code: Select all

TAG POS=1 TYPE=td ATTR=CLASS:confluenceTd CONTENT=Test
Once you've managed to find the "correct" Syntax for filling in one Field that works in Replay Mode, locating the specific Field that you want can probably be done using Relative Positioning for both a Cell within its Table (=> will probably always be 'POS=R4' from its corresponding Header) and for the Table itself, you probably have some unique Title for each Table on the Page...

But, hum..., difficult to help you precisely without being able to see how the Page looks like and being able to "play" with it myself...
Maybe you can find some 'Jira' Demo on Internet where you can reproduce your Scenario...?

You can try using the 'EVENT' Mode as well... :idea:
But hum, the Relative Positioning Technique is a bit tricky to use with the 'EVENT' Mode...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Graysonn
Posts: 3
Joined: Wed Aug 30, 2017 12:21 pm

Re: Inserting/pasting text into a table

Post by Graysonn » Mon Sep 11, 2017 10:53 am

ok, I think I found the issue. imacro's can't paste into a table element on a HTML page.

Now, javascript can. However I've got a problem there.

I'm running an imacro script which prompts for text and then inserts it. It's inserting everywhere except the table. I can use javascript to insert in the table however I don't know how to pass the variable from imacro's to the javascript. I've tried googling and reading all the wiki pages and I can't find an example. maybe I'm blind. is it possible?
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Inserting/pasting text into a table

Post by chivracq » Mon Sep 11, 2017 1:19 pm

Graysonn wrote:ok, I think I found the issue. imacro's can't paste into a table element on a HTML page.

Now, javascript can. However I've got a problem there.

I'm running an imacro script which prompts for text and then inserts it. It's inserting everywhere except the table. I can use javascript to insert in the table however I don't know how to pass the variable from imacro's to the javascript. I've tried googling and reading all the wiki pages and I can't find an example. maybe I'm blind. is it possible?
Hum..., your Post is still a bit "vague", it would help if you could post your whole Script, that I can understand a bit what your Script does (or is supposed to do, ah-ah...!), that would already give me an Idea of the HTML Structure of the Site/Page...

"imacro's can't paste into a table element on a HTML page."
=> Euh...!?, of course iMacros can "paste" into a "table element on a HTML page", that one of the main Functionalities of iMacros...! :?
Sometimes the 'TAG' Mode can have some "Difficulties" with Sites/Pages and Ajaxy Elements with a lot of JS on the Page, and the 'EVENT' Mode is normally able to handle those Elements better then... I've already mentioned the 'EVENT' Mode but you don't react about that...

"I can use javascript to insert in the table however I don't know how to pass the variable from imacro's to the javascript."
=> Not sure about which JavaScript Syntax you are talking about now, can't you post it...?

If you are talking about using a '.js' Script, then you need to use the '!EXTRACT' + 'iimGet(Last)Extract()' Mechanism for the '.iim' and '.js' parts to communicate with each other to pass Vars.
But from your FCI you are on CR but '.js' Scripts are only supported on FF using iMacros for FF. '.js' Scripts are not supported on CR.

If you are talking about the 'URL GOTO=javascript:' Syntax, then you can use Vars defined in your '.iim' like any other Vars using '{{!VAR1}}' like for example:

Code: Select all

SET !VAR1 500

'URL GOTO=javascript:window.scrollBy(0,500)
URL GOTO=javascript:window.scrollBy(0,{{!VAR1}})
PAUSE
Those 2 Syntaxes work as well (with Single or Double Quotes around the Var, but escaping Double Quotes doesn't work.):

Code: Select all

URL GOTO=javascript:window.scrollBy(0,'{{!VAR1}}')

Code: Select all

URL GOTO=javascript:window.scrollBy(0,"{{!VAR1}}")
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10-x64.)

Try to be a bit more "precise" in your Posts, it's difficult to help you if I don't know what you are talking about, ah-ah...! :idea:
I had suggested if you could find a Jira Demo on Internet where you could create a small Script to reproduce your Steps (but you didn't react either), some Jira Demo seems to be available on the 'Atlassian' Site:
https://www.atlassian.com/software/jira/demo
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply