Karthik
Karthik

Reputation: 2581

Selenium IDE: Pass a variable to open URL

The below is my Selenium IDE generated XML file.

<?xml version="1.0" encoding="UTF-8"?>
<TestCase seleniumIDEVersion="1.0.10" baseURL="http://test.com/">
<selenese>
    <command>open</command>
    <target><![CDATA[/test/contract/?testId=743474]]></target>
    <value><![CDATA[]]></value>
</selenese>
<selenese>
    <command>clickAndWait</command>
    <target><![CDATA[link=View All Test menus]]></target>
    <value><![CDATA[]]></value>
</selenese>
</TestCase>

I want to pass a variable here /test/contract/?testId={variable here} instead of the number.

Is it possible, please help me.

Upvotes: 1

Views: 7955

Answers (1)

Ross Patterson
Ross Patterson

Reputation: 9570

Just code /test/contract/?testId=${YourVariableName} and Selenium will substitute it in. Obviously you'll need to set the variable first, from whatever source you get it from. The Selenium reference has some examples.

Upvotes: 4

Related Questions