Mashandisiro Ekushandisa WebDriver Javascript Executor kuti uende ku URL

Selenium WebDriver inopa nzira dzekufamba kuenda kune url; izvi ndizvo driver.get() uye driver.navigate().to().

Semuyenzaniso:

driver.get('https://devqa.io')

uye

driver.navigate().to('https://devqa.io')

Kune imwezve nzira yekufamba kuenda ku url uye ndeyokushandisa iyo WebDriver's Javascript Executor, sezvakaratidzwa mune uyu muenzaniso.



WebDriver - Enda ku URL Uchishandisa JavaScript

Uchishandisa window.location:

import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class WebDriverJSExecutor {
private static String url = 'https://devqa.io';
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
((JavascriptExecutor)driver).executeScript('window.location = ''+url+''');
} }