Reputation: 2327
I am struggling with getting the id from a url in selenium ide please could you assist me Thanks. When I echo the store location it removes the equals? PLease see the comments for the output below. Thanks for any help given.
When I run the ide tests I run it through webdriver and on internet explorer but i dont think this should make much difference.
<tr>
// gets http//website.co.uk/index.php?main_detail_id=123456789123456
<td>storeLocation</td>
<td>loc</td>
<td></td>
</tr>
<tr>
//prints http//website.co.uk/index.php?main_detail_id123456789123456
<td>echo</td>
<td>${loc}</td>
<td></td>
</tr>
<tr>
//no errors have also tried split '?'
<td>storeEval</td>
<td>"${loc}".split('=')[2]</td>
<td>mainid</td>
</tr>
<tr>
//prints nothing.
<td>echo</td>
<td>${mainid}</td>
<td></td>
</tr>
Upvotes: 0
Views: 856
Reputation: 2002
Below is code with help of that you can get ID from URL
<tr>
<td>store</td>
<td>http//website.co.uk/index.php?main_detail_id=123456789123456</td>
<td>test</td>
</tr>
<tr>
<td>store</td>
<td>1</td>
<td>delimiter</td>
</tr>
<tr>
<td>store</td>
<td>javascript{storedVars['test'].split('=')[storedVars['delimiter']]}</td>
<td>vv</td>
</tr>
<tr>
<td>echo</td>
<td>${vv}</td>
<td></td>
</tr>
Upvotes: 1