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

Example Analysis of selenium + chrome in Raspberry Pie

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Raspberry pie twists and turns selenium + chrome example analysis, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

Raspberry pie twists and turns selenium + chrome record preface

The raspberry pie at home still continues to eat ash, sad. Done

Want to do an automatic login iqiyi, Youku and other websites to try to open the account system. Done.

Raspberry pie 7x24 hours for me to try to log in to the public account, and record the successful login account.

Record of twists and turns

I have been trying to build with raspbian + selenium + firefox, but failed. Try the address as a dead-end address reference

Use raspbian + selenium + chrome to run correctly and run well.

Install software install chrome

Chrome in raspberry pie is: chromium-browser

Use the command:

Sudo apt-get install chromium-browser

If it is reported that it cannot be installed, you need to add a source.

Add in the file / etc/apt/sources.list.

Deb http://pipplware.pplware.pt/pipplware/dists/jessie/main/binary /

Execute chromium-browser-- version to view the version information.

Chromium 48.0.2564.82 Built on Ubuntu 15.04, running on Raspbian 8.0

Download driver package chromium-chromedriver

Download the specified:

Chromium-chromedriver_48.0.2564.82-0ubuntu0.14.04.1.1108_armhf.deb

Download address:

Wget http://launchpadlibrarian.net/234968362/chromium-chromedriver_48.0.2564.82-0ubuntu0.14.04.1.1108_armhf.deb

If there is anything else, a search query is required.

Open https://launchpad.net/

Search for chromium-chromedriver armhf version number

Choose to download the specified deb file.

Download and install

Sudo dpkg-I chromium-chromedriver_48.0.2564.82-0ubuntu0.14.04.1.1108_armhf.deb install virtual desktops

Using softwar

Sudo apt-get install xvfb

Execute after installation

Xvfb-ac: 7-screen 0 1280x1024x8-extension RANDR-nolisten inet6 &

Import the system (: 7 is the same as the number number in the previous step)

Export DISPLAY=:7

It is recommended to add to the startup item. Because this needs to be restarted every time.

Add a remote selenium server.

Download the corresponding selenium-server-standalone-3.8.1.jar official website

Execute a command

Java-Dwebdriver.chrome.driver=/usr/lib/chromium-browser/chromedriver-jar selenium-server-standalone-3.8.1.jar

OK completed

# testing

DesiredCapabilities desiredCapabilities = new DesiredCapabilities (DesiredCapabilities.chrome ()); WebDriver webDriver = new RemoteWebDriver (new URL ("http:// server address: 4444/wd/hub/"), desiredCapabilities); webDriver.get ("http://www.baidu.com"); System.out.println (webDriver.getTitle ()); webDriver.quit ())

As a result, you will know as soon as you export Baidu.

Postscript:

The commands for virtual desktops together with launching server are:

DISPLAY=:7 xvfb-run-a-n 1-l-s'- screen 0,1920x1080x16' java-Dwebdriver.chrome.driver=/usr/lib/chromium-browser/chromedriver-jar selenium-server-standalone-3.8.1.jar this is the answer to the sample analysis question of raspberry pie messing around selenium + chrome. I hope the above content can be of some help to you, if you still have a lot of doubts unsolved. You can follow the industry information channel for more related knowledge.

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