Y
Y
Yaroslav Chikalov2017-04-18 15:54:04
PHP
Yaroslav Chikalov, 2017-04-18 15:54:04

Selenium IDE unloading tests in php. How to make it work with minimal intervention in the code?

Good day, dear friends.
I will try to describe to you the essence of the problem. Well... let's start.
Install selenium IDE in firefox and add. upload plugin in php.
We have two upload options:

  1. PHPUnit
  2. testing_selenium
6200f1f17bbd42cd83b598c7a49fa744.jpg
Let's download both.
This is where questions begin to emerge.
Let's take PHPUnit as an example.
Code uploaded:
class Example extends PHPUnit_Extensions_SeleniumTestCase
{
  protected function setUp()
  {
    $this->setBrowser("*chrome");
    $this->setBrowserUrl("https://www.google.ru/");
  }

  public function testMyTestCase()
  {
        $this->open("/");
        $this->type("name=q", "Да как заставить тебя работать?");
        $this->click("name=btnG");
        $this->waitForPageToLoad("30000");
  }
}

Problem: IDE unloads for the first selenium, which confirms the inheritance from "PHPUnit_Extensions_SeleniumTestCase"
Question: is there a plugin that will unload for the second selenium?
Then, seeing that we have selenium 1, not two, I edit to "PHPUnit_Extensions_Selenium2TestCase"
By the way, "phpunit/phpunit-selenium" is already installed: "^3.0" via composer
https://phpunit.de/manual/3.7/ en/selenium.html
Run selenium - selenium-server-standalone-3.3.1.jar
I'm trying to run the test as it is, so there's no way out.
255f665134c040ce911103aeac83a9b9.jpg
For some reason, a crazy idea comes to mind to remove the " * " next to chrome I try to run the test and firefox starts, and immediately closes,$this->setBrowser("chrome");
6edcf61f2391449a807b555411bb7046.jpg
Swears at I go to look at the parent, I hope to find the "open" method, but I don't find it in the class$this->open("/");
abstract class PHPUnit_Extensions_Selenium2TestCase extends PHPUnit_Framework_TestCase

The first two methods are:
$this->setBrowser("chrome");
$this->setBrowserUrl("https://www.google.ru/");

public function setBrowser($browserName)
    {
        if (!is_string($browserName)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
        }

        $this->parameters['browserName'] = $browserName;
    }

    public function setBrowserUrl($browserUrl)
    {
        if (!is_string($browserUrl)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
        }

        $this->parameters['browserUrl'] = new PHPUnit_Extensions_Selenium2TestCase_URL($browserUrl);
    }

Question: how then to test what I unloaded?
If we open "Test_selenium":
<?php

require_once 'Testing/Selenium.php';

class Example extends PHPUnit_Framework_TestCase
{
  protected function setUp()
  {
    $this = new Testing_Selenium("*chrome", "https://www.google.ru/")
        $this->open("/");
        $this->type("name=q", "Да как заставить тебя работать?");
        $this->click("name=btnG");
        $this->waitForPageToLoad("30000");
  }
}
?>

Almost a similar situation, but still Question: Where can I get it? What kind of class is this? Thanks to everyone who will respond!
require_once 'Testing/Selenium.php';

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question