Selenium Java Webdriver: Adding a string to an Xpath

前端 未结 1 1344
鱼传尺愫
鱼传尺愫 2021-01-27 10:34

I have the folllowing piece of Java in which I want to add a String inside a statement:

     @and (\"^I want to change fieldnumber \\\"([^\\\"]*)\\\" ,          


        
相关标签:
1条回答
  • 2021-01-27 11:28

    What about

    driver.findElement(By.xpath("//*[contains(@name,\"template:view:" + number+ ":item:view:1:item:\")]")).clear();
    

    And you probably need the number to be const, that means:

    public void testscenario12345(final String number,  String text) throws Throwable {
    
    0 讨论(0)
提交回复
热议问题