Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing URL using WebDriver

I'm using Selenium WebDriver (Java) and am trying to change the URL after WebDriver has logged into a page.

Is there a way to either:

  1. Change the URL of the current window, or
  2. Open a new tab and go to another page.

Thanks!

like image 902
FilmiHero Avatar asked Aug 30 '26 12:08

FilmiHero


1 Answers

You didn't share any code so i don't know how is your approach about it, I only share my knowledge about this subject.

1) For your first question i think you know how to open a new page with selenium web driver maybe you can use some wait method and then invoke the driver again.

    //open browser
    driver = new FirefoxDriver();

    //login
    driver.get("https://www.google.com/");

    //set implicit wait
    driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

    //Then invoke method again for your second request(I am not try this code maybe you need to create new driver object)
    driver.get("https://www.stackoverflow.com");

2) For your second question this link help you.

like image 118
erhun Avatar answered Sep 02 '26 01:09

erhun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!