PHP + selenium environment under the windows environment to build

Recently want to automate the entry test, also written before using codeception unit testing and interface testing, UI testing part I chose the selenium framework, then we have to build a relevant environment.

  • PHP environment to build

1, enter PHP Download  http://windows.php.net/download  download the latest version thread-safe PHP zip archive, unzip placed under the path you want to install. (It should be noted here, win7 system can not be used php7.4 version, you will be prompted lost VCRUNTIME140.dll)

2, into the PHP installation directory, copy php.ini-development  renamed  php.ini  into the installation path, find open  ; the extension_dir = EXT , uncomment, the value to  PHP installation path \ EXT .

3. Right Computer -> Properties -> Advanced System Settings -> Environment Variables -> System Variables under Path, click Edit, followed by the path of D PHP: \ Software \ php-7.2.28-Win32-VC15-x64 ;

At this point, PHP installation is complete, open the cmd view corresponding version, as shown:

 

 

  • Build java runtime environment, need to explain here selenium is running a jar file package, you have to build a good environment to enable java to run selenium.

Enter the official website, https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html , find adapted version, download jdk. Specific reference: https://www.jianshu.com/p/efef80171a4a

 

  •  Download selenium file, http: //selenium-release.storage.googleapis.com/index.html (selenium Download) Download selenium-server-standalone-3.8.0.jar a jar file version can choose

  • Download the browser driver files (It should be noted that: Be sure to download and install the native driver file browser version match). Google browser to use the driver file is named: chromedriver, https: //chromedriver.storage.googleapis.com/index.html (chrome driver download address). Firefox driver file is named: geckodriver.exe, https: //docs.seleniumhq.org/download/ (selenium official website to download, select the java)

   Version and chrom chromedriver view corresponding to the inside of each version note, chrome version number can be obtained by chrome: / help // settings See

Note: The download is complete drivers to put php root directory

 

  •  Download the demo file PHP + selenium, https://github.com/facebook/php-webdriver  (example.php and there are documents in the case file tests were reference).
  • Written after the demo you can test, first run the downloaded selenium jar package file, cmd command line into your file directory selenium placement and execute the following command (note: java runtime environment needs to be configured in a second step variable) java -jar selenium-server-standalone-3.8.0.jar. If your command line prompt that appears following a successful launch.

 

 

 

 

Guess you like

Origin www.cnblogs.com/cfYu/p/12450135.html