How to use/attach an existing browser using Selenium?

前端 未结 2 2137
天命终不由人
天命终不由人 2020-11-30 09:09

What is the Selenium equivalent to attaching an existing browser in Watir?

brw = Watir::IE.attach(:title, \"Google\")
2条回答
  •  囚心锁ツ
    2020-11-30 09:33

    1. Run a Webdriver first

      driver = new FirefoxDriver();

    2. Now run a RemoteWebdriver

      DesiredCapabilities capabilities = DesiredCapabilities.firefox();
      driver = new RemoteWebDriver(new URL("http://localhost:7055/hub"),capabilities);

    The RemoteWebdriver will attach to the first browser window running Webdriver and it will not create a new window.


    Note: Run Webdriver (1) and RemoteWebdriver (2) in separate programs one-by-one).

提交回复
热议问题