Wednesday, 9 January 2019

Append query string to current URL with single parameter or only with key -way 2

Append query string to current URL with single parameter or only with key -way 2
Step 1 : Need to get current URL
String currentUrl = driver.getCurrentUrl();
Step2: Take new string to store value
 String newUrl = null;
Step3:
Add parameters to URI builder class
try {
            newUrl = new URIBuilder(currentUrl).addParameter(key/parameter, null).toString();
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
  driver.get(newUrl);

No comments:

Post a Comment