How to give the runtime input in selenium IDE?

别说谁变了你拦得住时间么 提交于 2021-01-29 13:33:08

问题


I want to get input at runtime using selenium ide. could any one help me?


回答1:


You can put break command or input-box

1.By input-box
Command 1
Command 2
Command 3
4th command will be
storeEval | prompt(“Enter input”); |variable
type | locator of field where you want to put value| ${variable}
continue with your next commands

2.By break command

Command 1
Command 2
Command 3
4th command will be
Break
Enter input manually and resume execution of test
continue with your next commands

Sample Script for you




回答2:


you can use java.util.scanner for entering user input during runtime.

import java.util.Scanner;

public class UserInputExample(){
  Scanner inputText = new Scanner(System.in);
  public static void main(String[] args ){
    String search= inputText.next();
 driver.findElement(By.xpath("//body/div[@id='searchform']/form[@id='tsf']/div[2]/div[1]/div[2]/div[1]/div[2]/input[1]")).clear().sendKeys(search);

  }
}


来源:https://stackoverflow.com/questions/11464452/how-to-give-the-runtime-input-in-selenium-ide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!