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