Linux Run Selenium Chrome issue under command line

Source: Internet
Author: User

1.chrome is now not allowed to run with root.

2. No interface chromedriver calling Chrome will make an error.

< also be sure to match chromedriver and chrome versions. It's going to be a strange question!!! >

The first problem solution:

Create a new user.

Runuser-l username-c ' Python3 xxx.py '

Second question:

1. Installing XVFB and Pyvirtualdisplay

Yum Install Xorg-x11-server-xvfb

Pip Install Pyvirtualdisplay

2. Install Firefox and Selenium

Yum Install Firefox

Pip Install Selenium

to here. The environment is well-equipped. The next step is to get the code.

3. Sample Code

 from Import Display  from Import  = Display (visible=0, size= (= webdriver. Firefox () driver.get ('http://www.cnblogs.com')print driver.titledriver.quit () display.stop ( )

Runuser extension

The Runuser command runs a shell with an alternate user or group ID. This command is only useful for root users.
Runs only with the session Pam Hook and does not have a password hint. If a non-root user is used and the user does not have permission to set user ID, the command will fail because the program does not have setuid. Because Runuser does not run authentication and account Pam hooks, it is lower than Su.

1. Runuser syntax

The syntax is basically the same as the SU command:

-,-L,–login

Let the shell become the login shell, replace the default with the Runuser-l PAM file;

-g–group=group

Designate the primary group;

-g–supp-group=group

Specify an append group

-c,–command=command

Use-C to pass a single command into the shell, after executing the command, exit to root;

–session-command=command

A single command with the-c parameter to the shell does not create a new session;

-f,–fast

Pass the-f parameter to the shell (for csh or tcsh);

-m,–preserve-environment

Do not reset environment variables;

-P Same As-m

-s,–shell=shell

Specifies the shell that executes the command;

2. Runuser sample

' /path/to/command arg1 arg2 '  'ulimit-sha'-s/bin/sh"/usr/local/nginx/ Sbin/nginx"

Linux Run Selenium Chrome issue under command line

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.