Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
quake004
Posts : 5
Join date : 2015-03-24

Copy contents of table to a list on another page Empty Copy contents of table to a list on another page

Tue Mar 24, 2015 10:01 pm
I'm trying to loop through the elements of a table to store each of them in a variable and then go to another page and paste the contents off all the variables, one per line, but I'm getting an error in the loop:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="es.magiccardmarket.eu/" />
<title>test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">test</td></tr>
</thead><tbody>
<tr>
 <td>open</td>
 <td>es.magiccardmarket.eu/?mainPage=browseUserProducts&idCategory=1&idUser=13786</td>
 <td></td>
</tr>
<tr>
 <td>store</td>
 <td>1</td>
 <td>x</td>
</tr>
<tr>
 <td>label</td>
 <td>target1</td>
 <td></td>
</tr>
<tr>
 <td>storeTable</td>
 <td>//div[@id='siteContents']/div[2]/div[2]/div/form/table.${x}.2</td>
 <td>card{$x}</td>
</tr>
<tr>
 <td>store</td>
 <td>new Number{${x} + 1}</td>
 <td>x</td>
</tr>
<tr>
 <td>gotoIf</td>
 <td>${x} < 31</td>
 <td>target1</td>
</tr>
<tr>
 <td>open</td>
 <td>quackit.com/html/codes/html_text_box_code.cfm</td>
 <td></td>
</tr>
<tr>
 <td>store</td>
 <td>1</td>
 <td>x</td>
</tr>
<tr>
 <td>store</td>
 <td>1</td>
 <td>y</td>
</tr>
<tr>
 <td>label</td>
 <td>target2</td>
 <td></td>
</tr>
<tr>
 <td>type</td>
 <td>name=comments</td>
 <td>{$card{$x}}<br /></td>
</tr>
<tr>
 <td>store</td>
 <td>new Number{${x} + 1}</td>
 <td>x</td>
</tr>
<tr>
 <td>store</td>
 <td>new Number{${y} + 1}</td>
 <td>y</td>
</tr>
<tr>
 <td>gotoIf</td>
 <td>${y} < 30</td>
 <td>target2</td>
</tr>
</tbody></table>
</body>
</html>
avatar
quake004
Posts : 5
Join date : 2015-03-24

Copy contents of table to a list on another page Empty Re: Copy contents of table to a list on another page

Wed Mar 25, 2015 7:12 pm
I found some errors. Know the only thing that last is to type the value in a variable like ${card${x}}

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="eu.magiccardmarket.eu/" />
<title>test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">test</td></tr>
</thead><tbody>
<tr>
 <td>open</td>
 <td>eu.magiccardmarket.eu/?mainPage=browseUserProducts&idCategory=1&idUser=13786</td>
 <td></td>
</tr>
<tr>
 <td>store</td>
 <td>1</td>
 <td>x</td>
</tr>
<tr>
 <td>label</td>
 <td>target1</td>
 <td></td>
</tr>
<tr>
 <td>storeTable</td>
 <td>//div[@id='siteContents']/div[2]/div[2]/div/form/table.${x}.2</td>
 <td>card${x}</td>
</tr>
<tr>
 <td>storeEval</td>
 <td>new Number(${x}) + 1</td>
 <td>x</td>
</tr>
<tr>
 <td>gotoIf</td>
 <td>storedVars['x'] < 31</td>
 <td>target1</td>
</tr>
<tr>
 <td>open</td>
 <td>quackit.com/html/codes/html_text_box_code.cfm</td>
 <td></td>
</tr>
<tr>
 <td>store</td>
 <td>1</td>
 <td>x</td>
</tr>
<tr>
 <td>store</td>
 <td>1</td>
 <td>y</td>
</tr>
<tr>
 <td>label</td>
 <td>target2</td>
 <td></td>
</tr>
<tr>
 <td>type</td>
 <td>name=comments</td>
 <td>${card${x}}<br /></td>
</tr>
<tr>
 <td>storeEval</td>
 <td>new Number(${x}) + 1</td>
 <td>x</td>
</tr>
<tr>
 <td>storeEval</td>
 <td>new Number(${y}) + 1</td>
 <td>y</td>
</tr>
<tr>
 <td>gotoIf</td>
 <td>storedVars['y'] < 31</td>
 <td>target2</td>
</tr>
</tbody></table>
</body>
</html>
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO

Copy contents of table to a list on another page Empty Re: Copy contents of table to a list on another page

Sat Mar 28, 2015 5:53 am
Is this all one script? I loaded it and see you are trying to open a new URL with the same baseURL as the next step. This is obviously failing since the URL is appended making it incorrect. To fix this open the script in a text editor such as Notepad. Change the line href="eu.magiccardmarket.eu/" to href="". You should also update your urls to have http:// in front of them.  I did this and everything passed for me.
Sponsored content

Copy contents of table to a list on another page Empty Re: Copy contents of table to a list on another page

Back to top
Permissions in this forum:
You cannot reply to topics in this forum