简体   繁体   中英

selenium pass value from a file

i am trying to pass a value to test case from a file. here i have worked on a small example, created a js file with content,

var sch = 'java';    // sch.js and added to ide options - selenium ide extension 

i have attached my test case and result i got. the variable value is not read by the ide.

在此处输入图片说明

在此处输入图片说明

You need to add one more command:

storeEval | sch | sch

to read variable from you js-file.

Please note, that you need to save your test, restart Selenium IDE and open test again for correct saving of your selenium ide extensions.

This code works:

<tr>
    <td>open</td>
    <td>/</td>
    <td></td>
</tr>
<tr>
    <td>storeEval</td>
    <td>sch</td>
    <td>sch</td>
</tr>
<tr>
    <td>type</td>
    <td>id=gbqfq</td>
    <td>${sch}</td>
</tr>

The Selenium IDE is not really a tool designed to run your testcases. It helps to generate code that you can use to write your testcases, eg, in a programming language like Java. Of course you can then read parameters from a file using Java.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM