java - 使用selenium获取页面源代码,如何在没有firefox的服务器上使用我的代码?

标签 java firefox selenium

当我使用selenium获取页面源时,它将通过系统Firefox使用selenium服务器。当服务器没有 Firefox 时,如何在服务器上加载我的代码?

Web-driver driver = new Firefox-driver();
        driver.navigate().to(url);
        String st = driver.getPageSource();
        driver.close();

最佳答案

如果selenium仅用于抓取/爬行,则可以选择Headless firefox 点击链接 http://www.installationpage.com/selenium/how-to-run-selenium-headless-firefox-in-ubuntu/

关于java - 使用selenium获取页面源代码,如何在没有firefox的服务器上使用我的代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23783766/

相关文章:

python - EC.element_to_be_clickable 和 EC.presence_of_element_located to click() 一个元素的区别

Firefox 重定向 Nginx 重写

javascript - event.path 未定义在 Firefox 中运行

python - 我正在尝试将已刮取的数据写入/粘贴到特定的 Excel 电子表格单元格位置,但我不知道如何去做

java - 与 Integer.MAX_VALUE 比较并使用 System.out.println 时,for 循环提前终止

javascript - 如何通过 HTTP(如 JavaScript)发送 Mozilla Firefox IonMonkey MIR?

google-chrome - 如何在 Selenium (C#) 中自动打开 Chrome Devtools 选项卡?

java - 使用@extends时空白节奏输出

java - java中找不到路径名

java - 安卓 : How to get view class from a view to use with instanceOf