Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Build the java environment of selenium phantomjs browser

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Build × × × face browser by java selenium

1. Http://phantomjs.org/

Download phantomjs for windows

two。 After decompression, there will be exe files in the bin directory.

3. Test the code:

Copy the code

Package se

Import org.openqa.selenium.WebDriver

Import org.openqa.selenium.firefox.FirefoxDriver

Import org.openqa.selenium.phantomjs.PhantomJSDriver

Public class test {

Public static void main (String [] args) {/ / TODO Auto-generated method stub// System.setProperty ("webdriver.gecko.driver", "C:\ Program Files (x86)\\ Mozilla Firefox\\ geckodriver.exe"); System.setProperty ("phantomjs.binary.path", "C:\ phantomjs-2.1.1-windows\\ bin\\ phantomjs.exe"); / / WebDriver driver = new FirefoxDriver (); WebDriver driver = new PhantomJSDriver () Driver.get ("http://www.baidu.com"); System.out.println (driver.getCurrentUrl ());}

}

4.url prints successfully

5.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report