Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

Java binding doesn't expand variables in regular expressions #1599

Open
@lukeis

Description

@lukeis

Originally reported on Google Code with ID 1599

Test case:

    store | Privacy | re_priv
    open | http://www.google.com/
    verifyText | //center[@id='fctr']/p/a | regex:${re_priv}

Options > Format > TestNG (Remote Control):

    package com.example.tests;

    import com.thoughtworks.selenium.*;
    import org.testng.annotations.*;
    import static org.testng.Assert.*;
    import java.util.regex.Pattern;

    public class RegEx extends SeleneseTestNgHelper {
    @Test public void testRegEx() throws Exception {
        String re_priv = "Privacy";
        selenium.open("http://www.google.com/");
        verifyTrue(Pattern.compile("${re_priv}").matcher(selenium.getText("//center[@id='fctr']/p/a")).find());
    }
    }

This compiles, but when run:

    java.util.regex.PatternSyntaxException: Illegal repetition near index 0
    ${re_priv}
    ^

The line should be:

    verifyTrue(Pattern.compile(re_priv) ...

IDE 1.0.10; Firefox 4.0; Linux

Reported by [email protected] on 2011-04-26 22:46:39

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions