Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SeleniumSessionAnalyzer.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\ObjectManagerInterface;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Magento\Mtf\Client\Driver\Selenium\Driver;
13 
17 class SeleniumSessionAnalyzer extends \Symfony\Component\Console\Command\Command
18 {
24  private $objectManager;
25 
29  public function __construct(ObjectManagerInterface $objectManager)
30  {
31  parent::__construct();
32  $this->objectManager = $objectManager;
33  }
34 
40  protected function configure()
41  {
42  parent::configure();
43  $this->setName('troubleshooting:check-selenium-session-connection')
44  ->setDescription('Check that Selenium session connection is established.');
45  }
46 
55  protected function execute(InputInterface $input, OutputInterface $output)
56  {
57  $output = $this->objectManager->create(
58  \Magento\Mtf\Console\Output::class,
59  ['output' => $output]
60  );
61  $output->writeln("Verifying selenium server session...");
62  try {
63  $driver = $this->objectManager->create(Driver::class);
64  $driver->closeWindow();
65  } catch (\Exception $e) {
66  $output->outputMessages(['error' =>
67  [
68  'The Selenium Server session cannot be established. Check if:'
69  . PHP_EOL . "\tSelenium server is launched."
70  . PHP_EOL . "\tSelenium server host and port configuration are correct in etc/config.xml."
71  . PHP_EOL . "\tThere is a valid browser name in etc/config.xml."
72  . PHP_EOL . "\tSelenium server is run with appropriate driver."
73  . PHP_EOL . "\tSelenium server version is compatible with web browser version."
74  ]
75  ]);
76  }
77  $output->writeln('Verification of selenium server session is finished.');
78  }
79 }
__construct(ObjectManagerInterface $objectManager)
$objectManager
Definition: bootstrap.php:17
execute(InputInterface $input, OutputInterface $output)