M
M
maksimwork19802022-04-04 17:30:26
PHP
maksimwork1980, 2022-04-04 17:30:26

How to install and run Selenium from PHP (On Libux Debian?

I've been trying to understand for a very long time. Is it correct that I need Selenium Grid? Here I downloaded the file, when I try to run it, this is displayed:
624b0094056a5190414284.png
After a bunch of attempts, now some errors are displayed.
PS This is my hobby, it's different at work.

spoiler
21:27:17.597 INFO [LogManager$RootLogger.log] - Using the system default encoding
21:27:17.606 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
21:27:19.384 INFO [NodeOptions.getSessionFactories] - Detected 1 available processors
21:27:19.431 INFO [NodeOptions.discoverDrivers] - Discovered 0 driver(s)
21:27:19.463 WARN [NodeOptions.addDetectedDrivers] - No drivers have been configured or have been found on PATH
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.openqa.selenium.grid.Bootstrap.runMain(Bootstrap.java:77)
        at org.openqa.selenium.grid.Bootstrap.main(Bootstrap.java:70)
Caused by: org.openqa.selenium.grid.config.ConfigException: java.lang.reflect.InvocationTargetException
        at org.openqa.selenium.grid.config.MemoizedConfig.getClass(MemoizedConfig.java:115)
        at org.openqa.selenium.grid.node.config.NodeOptions.getNode(NodeOptions.java:149)
        at org.openqa.selenium.grid.commands.Standalone.createHandlers(Standalone.java:203)
        at org.openqa.selenium.grid.TemplateGridServerCommand.asServer(TemplateGridServerCommand.java:41)
        at org.openqa.selenium.grid.commands.Standalone.execute(Standalone.java:214)
        at org.openqa.selenium.grid.TemplateGridCommand.lambda$configure$4(TemplateGridCommand.java:129)
        at org.openqa.selenium.grid.Main.launch(Main.java:83)
        at org.openqa.selenium.grid.Main.go(Main.java:57)
        at org.openqa.selenium.grid.Main.main(Main.java:42)
        ... 6 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.openqa.selenium.grid.config.ClassCreation.callCreateMethod(ClassCreation.java:50)
        at org.openqa.selenium.grid.config.MemoizedConfig.lambda$getClass$4(MemoizedConfig.java:100)
        at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1688)
        at org.openqa.selenium.grid.config.MemoizedConfig.getClass(MemoizedConfig.java:95)
        ... 14 more
Caused by: org.openqa.selenium.grid.config.ConfigException: No drivers have been configured or have been found on PATH
        at org.openqa.selenium.grid.node.config.NodeOptions.addDetectedDrivers(NodeOptions.java:426)
        at org.openqa.selenium.grid.node.config.NodeOptions.getSessionFactories(NodeOptions.java:210)
        at org.openqa.selenium.grid.node.local.LocalNodeFactory.create(LocalNodeFactory.java:76)
        ... 22 more

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
menartIsH, 2022-04-14
@menartIsH

Try with docker

version: "3.1"
services:
  php:
    build: ./docker/php
    working_dir: /www
    ports:
      - 9000:9000
    volumes:
      - ./www:/www
     # - ./docker/php/docker-xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
    networks:
      - main_network

  selenium:
    image: selenium/standalone-chrome-debug
    environment:
      VNC_NO_PASSWORD: 1
#      SCREEN_WIDTH: 1366
#      SCREEN_HEIGHT: 768
#      SCREEN_DEPTH: 24
#      SCREEN_DPI: 74
    volumes:
      - /dev/shm:/dev/shm
    ports:
      - 4444:4444
      - 5900:5900
    networks:
      - main_network
    #network_mode: "host"

networks:
  main_network:
    driver: bridge
    name: main_network
    ipam:

I manage using
https://mink.behat.org/en/latest/
you can connect to selenium via vnc on port 5900. Or web via port 4444

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question