Giter Club home page Giter Club logo

php-webdriver's People

Contributors

adam-lynch avatar adamgoucher avatar astrumas avatar bernardpeh avatar jubishop avatar nicoder avatar piotrrepetowski avatar volkan avatar wheelsandcogs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-webdriver's Issues

How to execute javascript code?

In the original facebook php webdriver I could just use

$script = "alert('hello world)";
$driver->executeScript($script);

But there is no info on how this works in this fork.

Change proxy settings at runtime (firefox)

I want to change the proxy settings of a job during runtime.

i.e.

  1. Execute one request without a proxy
  2. Execute another request with a proxy

This needs to happen within a single selenium job. Is this possible? I looked at the JsonWireProtocol specs and so far didn't find anything related to this.

Class 'WebDriverBase' not found in WebDriverStorage.php on line 32

Hi -

I downloaded latest bits (as the ones I was running were a few months old and I was experiencing issues trying to get IE to wait for an element) and immediately ran into the php fatal error listed in the title. I am running phpwebdriver tests in phpunit which has been working swimmingly until now. To be sure it wasn't something with my local environment, I installed using pear and am getting the same error.

This is under Ubuntu 12.04 running php 5.3.10-1ubuntu3.2. I can test this on other OSes as necessary. Any help greatly appreciated.

Thanks -

Steve

Exception Handling and Logging

Exceptions stop testing but keep the sessions open. Is there any way to log these exceptions and kill abandoned sessions?

Depreciated Warning issued for SendKeys

When using sendKeys with the current Selenium build I'm getting exceptions:

Deprecated Warning:Use PHPWebDriver_WebDriverKeys('KeyName')\n

It works (key is pressed in browser) but the warning shows up in results.

Documentation

Can we get better documentation? I mean the stuff that's in the readme. It's not very clear.

It would be good even if it was just split up a bit, but I wouldn't mind contributing to a standalone docs page(s). Maybe on a gh-pages branch like a lot of projects have; e.g. Bootstrap.

Selenium returns null ({"ELEMENT":"0"}) on my every element finding attempts.

PHP-Webdiver also returns null, however to test things out I've written my own script, here is a brief description of the problem:

I have an Ubuntu server running on a VPS with LXDE and Firefox been installed. Also I've started Selenium server using this command:

java -jar selenium-server-standalone-2.33.0.jar

it is now running and listens on localhost port 4444. To connect to selenium server via PHP I use this simple script :

$url = "http://www.amazon.com";
$dc = array("browserName" => "firefox",
                 "version" => "",
                 "platform" => "ANY",
                 "javascriptEnabled" => True);

// To get the session id
$session_id = get_id($dc);  

// Open 'amazon.com'
$new_map = "/session/".$session_id."/url";
$result = curl_transfer('POST', array('url' => $url), $new_map);

// Wait until the page completely been loaded
$new_map = "/session".$session_id."/timeouts/implicit_wait";
curl_transfer('POST', array('ms' => 7000), $new_map);

// Find an element, here is the Brazil link at the bottom of the page
$new_map = "/session/".$session_id."/element";
$t = curl_transfer('POST', array('using' => 'link text', 'value' => 'Brazil'), $new_map);

print_r($t);


function curl_transfer ($method, $params, $map){
   $path = 'http://localhost:4444/wd/hub'.$map;
   $c = curl_init($path);
   if ($method === 'POST') {

       $encoded_params = json_encode($params);

       curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 30);
       curl_setopt($c, CURLINFO_HEADER_OUT, true);
       curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($c, CURLOPT_HEADER, true);
       curl_setopt($c, CURLOPT_HTTPHEADER, array(
               'Content-Type: application/json;charset=UTF-8',
               'Accept: application/json',
               'Expect:'));
       curl_setopt($c, CURLOPT_POST, 1);
       curl_setopt($c, CURLOPT_POSTFIELDS, $encoded_params);

       $raw_result = curl_exec($c);
       // print_r(curl_getinfo($c)); 
       return (string)$raw_result;
   }
   if ($method === 'GET') {

      curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 30);
      curl_setopt($c, CURLINFO_HEADER_OUT, true);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_HEADER, true);

  $raw_result = curl_exec($c);
      // print_r(curl_getinfo($c)); 
      return (string)$raw_result;
   }
}

function get_id ($dc){
   $result = curl_transfer('POST', array('desiredCapabilities' => $dc), '/session');
   $array_result = explode ("\r\n", $result);
   $id = str_replace("Location: http://localhost:4444/wd/hub/session/", "", $array_result[6]);
   return $id;
}

Everything works fine, the session is being started and Firefox is navigated to Amazon.com,
however with every attempts that I did to find an element I get this as the return object:

{"status":0,"sessionId":"3a0d5939-595e-40d6-88c8-fe6f22a165dd","value":{"ELEMENT":"0"},"state":null,"class":"org.openqa.selenium.remote.Response","hCode":15920450}

It seems that the element hasn't been found at all. What's wrong here? Any idea?

No way to get page title?

Hello, Like the library but I cannot seem to find a way to get the current page title of a session...

Get many elements

Sorry for this if it's not an issue, but I didn't see any method like "findElements..." that php-webdriver-bindings have.
the $element($strategy, $value) always return the first element if more than one exist.

FIle Uploading Problem - Exception 500

My code thows the exception 500.

    self::$session->open('http://localhost/test/file/1.php');
    $file1 = dirname(__FILE__) . '/files/1.jpg';
    $e = self::$session->element('name', 'fUserPhoto');
    $e->sendKeys($file1);

I tried the FileUploadTest.php, it's not working, same reason. Any ideas?

Here is the selenium output:

19:18:34.347 INFO - Executing: [get: http://localhost/test/file/1.php] at URL: /session/3341c498-6135-4129-bbe0-a4c00aab4c3e/url)
19:18:35.093 INFO - Done: /session/3341c498-6135-4129-bbe0-a4c00aab4c3e/url
19:18:35.104 INFO - Executing: [find element: By.name: fUserPhoto] at URL: /session/3341c498-6135-4129-bbe0-a4c00aab4c3e/element)
19:18:35.150 INFO - Done: /session/3341c498-6135-4129-bbe0-a4c00aab4c3e/element
19:18:35.169 INFO - Executing: org.openqa.selenium.remote.server.handler.UploadFile@a9e1af at URL: /session/3341c498-6135-4129-bbe0-a4c00aab4c3e/file)
19:18:35.175 INFO - Done: /session/3341c498-6135-4129-bbe0-a4c00aab4c3e/file
19:18:35.186 WARN - Fatal, unhandled exception: /session/3341c498-6135-4129-bbe0-a4c00aab4c3e/element/0/value: java.lang.NumberFormatException: For input string: "ploa"
19:18:35.187 INFO - WebDriver remote server: Fatal, unhandled exception: /session/3341c498-6135-4129-bbe0-a4c00aab4c3e/element/0/value: org.openqa.selenium.WebDriverException: java.lang.NumberFormatException: For input string: "ploa"
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_17'
Driver info: driver.version: unknown
19:18:35.187 WARN - EXCEPTION
javax.servlet.ServletException: org.openqa.selenium.WebDriverException: java.lan
g.NumberFormatException: For input string: "ploa"
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.versi
on: '1.7.0_17'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverS
ervlet.java:206)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.
java:167)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet
.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.jav
a:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler
.java:677)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.j
ava:568)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:914)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)

    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:9
  1. at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.
    

java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: org.openqa.selenium.WebDriverException: java.lang.NumberFormatExcepti
on: For input string: "ploa"
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.versi
on: '1.7.0_17'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(
JsonHttpRemoteConfig.java:199)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverS
ervlet.java:201)
... 16 more
Caused by: java.lang.NumberFormatException: For input string: "ploa"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at org.json.JSONTokener.nextString(JSONTokener.java:294)
at org.json.JSONTokener.nextValue(JSONTokener.java:371)
at org.json.JSONArray.(JSONArray.java:127)
at org.json.JSONTokener.nextValue(JSONTokener.java:378)
at org.json.JSONObject.(JSONObject.java:206)
at org.json.JSONObject.(JSONObject.java:403)
at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConv
erter.java:202)
at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConv
erter.java:42)
at org.openqa.selenium.remote.server.rest.ResultConfig.setJsonParameters
(ResultConfig.java:299)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConf
ig.java:191)
at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(
JsonHttpRemoteConfig.java:192)
... 17 more
19:18:35.190 ERROR - /wd/hub/session/3341c498-6135-4129-bbe0-a4c00aab4c3e/elemen
t/0/value:
org.openqa.selenium.WebDriverException: java.lang.NumberFormatException: For inp
ut string: "ploa"
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.versi
on: '1.7.0_17'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(
JsonHttpRemoteConfig.java:199)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverS
ervlet.java:201)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.
java:167)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet
.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.jav
a:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler
.java:677)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.j
ava:568)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:914)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)

    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:9
  1. at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.
    

java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: java.lang.NumberFormatException: For input string: "ploa"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at org.json.JSONTokener.nextString(JSONTokener.java:294)
at org.json.JSONTokener.nextValue(JSONTokener.java:371)
at org.json.JSONArray.(JSONArray.java:127)
at org.json.JSONTokener.nextValue(JSONTokener.java:378)
at org.json.JSONObject.(JSONObject.java:206)
at org.json.JSONObject.(JSONObject.java:403)
at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConv
erter.java:202)
at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConv
erter.java:42)
at org.openqa.selenium.remote.server.rest.ResultConfig.setJsonParameters
(ResultConfig.java:299)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConf
ig.java:191)
at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(
JsonHttpRemoteConfig.java:192)
... 17 more

Fatal error: Class 'PHPWebDriver_WebDriverContainer' not found

Hello!
All the time when I execute more than once my script I receive this message:

"Fatal error: Class 'PHPWebDriver_WebDriverContainer' not found in /Users/eliasnogueira/test/PHPWebDriver/WebDriverElement.php on line 16"

I trying to run with a simple script like this:

require_once "PHPWebDriver/__init__.php";

$webdriver = new PHPWebDriver_WebDriver();

$session = $webdriver->session('firefox', array());
$session->implicitlyWait(10);

$session->open('http://www.tizag.com/htmlT/htmlselect.php');
$session->element("css selector","select[name='selectionField'] option[value='CO']")->click();

$session->close();

A weird workaround is replace the PHPWebDriver folder.
There's something that I need to do?

Packagist

Would you mind putting this project on Packagist?
We'd love to use Composer to manage our use of this project a bit better (like we do with some others), to be sure which version we're using/have modified, etc.

All that's required is that a composer.json file is added at the root of the project containing a summary of the project, versions are tagged (git tag -a 2.1.0 -m "tagging 2.1.0" / git tag -am "2.1.0") and that the GitHub service hook is set up.
See the Packagist about page for more detail on each step.

The next action is run before the page is loaded

Each time I try running all my selenium actions, I get different results. Some times everything is successful, but sometimes elements cannot be found even though I did not change my code. The strangest thing is each time it is a different element that cannot be found. I find that the elements that are not found are the ones that are searched for right after a page reload. Is there a way other than putting a wait after each click of a button or link to make the script wait for the page to finishing loading before the next action is applied?

Thanks.

php-webdriver 1.12.0 broken when using chromedriver v2.3 directly

We have 2 setups for our UI testing :

  • On our CI server we use Selenium grid 2.35 + remotewebdriver using ChromeDriver (2.3) & IEServerDriver : this combination works as expected
  • Locally we use directly the Chromedriver (2.3) or IEServerDrivers . In this case the functionality of the API is broken. The URL to be launched from the test is not opened by the browser.. Since php-webdriver 1.12.0 this is broken. Reverting to 1.11.0 solves the issue ... I suspect this had to do with the changed sessionId handling introduced in Selenium 2.35 ?

User Agent

Please show me an example how to add custom user agent.

Thanks

PEAR install returns no releases for packages

When trying to install php-webdriver via PEAR I get the following:

pear install -f element-34/PHPWebDriver
No releases for package "element-34/PHPWebDriver" exist
install failed

I ran what was is given on the github page:

pear channel-discover element-34.github.com/pear
pear install -f element-34/PHPWebDriver <- Problem happens here

Then I ran the following:

pear list -c element-34

Result:

(no packages installed from channel element-34.github.com/pear)

Is the pear channel for this library working or available at the moment?

If not is there manual instructions to install this library without using PEAR.

Why not connect 'SaunterPHP_Framework_Exception'

Hi all I'm trying to run the test described in the file ProfileTest.php folder test
And get this error:

PHPUnit 5.5.1 by Sebastian Bergmann and contributors.

E 1 / 1 (100%)
Time: 301 ms, Memory: 8.00MB
There was 1 error:

  1. ProfileTest::testProfileExists
    Error: Class 'SaunterPHP_Framework_Exception' not found
    /home/PHPWebDriver/WebDriverFirefoxProfile.php:43
    /home/PHPWebDriver/WebDriver.php:49
    /home/ProfTiber/php-webdriver/test/ProfileTest.php:15
    ERRORS!
    Tests: 1, Assertions: 0, Errors: 1.

Tell me what can be the error? All banal is excluded...

Please tell me how to set the parameters about:config

Hello I have this code:

require_once(dirname(__FILE__) . '/vendor/autoload.php');
require_once(dirname(__FILE__) . '/PHPWebDriver/WebDriver.php');
require_once(dirname(__FILE__) . '/PHPWebDriver/WebDriverFirefoxProfile.php');
 
$driver = new PHPWebDriver_WebDriver();
$profile = new PHPWebDriver_WebDriverFirefoxProfile('/tmp/1.zip');
$session = $driver->session('firefox', array(), array(), $browser_profile=$profile);
$session->open("example.com");
$session->close();

How do I add ( install ) the value in about:config
I'm a classic php web driver did so
$profile = new \Facebook\WebDriver\Firefox\FirefoxProfile(); $profile->setPreference('geo.enabled', false); $profile->setPreference('network.proxy.socks_remote_dns', false); $profile->setPreference('permissions.default.image', 0);

How do you not tell me?

Get element by xpath don't work

I'm trying to get an element by xpath and the strategy is my the visible text in a combo.

I have tried a command like this, but always fail

$session->element("xpath","//select[@name='name']/option[normalize-space(text())='TEXT']");

As the combo values are dynamic I'm unable to use this by css selector

$session->element("css selector","select[name='name'] option[value='VALUE']");

There's a supported way to do that?

Opening Session with Grid2

I want to be able to have parallel tests running. How do I start a session thru a Grid hub so that it is queued for the nodes?

How to set Chrome profile

Hello,

is it possible to set chrome profile somehow? ...like for facebook webdriver:

$options = new ChromeOptions();
$options->addArguments(array('user-data-dir=/path/to/chrome_profile'));
$capabilities = DesiredCapabilities::chrome(); 
$capabilities->setCapability(ChromeOptions::CAPABILITY, $options);
$driver = RemoteWebDriver::create($host, $capabilities, 0, 0);

Support directory is not included when installing via PEAR

Hi,

First of all, I would like to thank you guys, for this very nice tool.

I'd like to report that when you install this via PEAR
pear install element-34/PHPWebDriver
The "Support" directory isn't included, so I have to manually copy it to installation directory.
We've been using this tool to test HTML5 video controls.

Thanks.

AJAX loading of the page

Not sure if this is the right place to raise this but....

I am running a test that fills in a form inside an iframe, then upon submitting the form it makes an AJAX request that hides the form and fills in a div and makes it visible.

For some reason when it comes to the second div it seems to think its still hidden because I get this error:

13:44:26.709 WARN - Exception: Element is not currently visible and so may not be interacted with

However I can see the submit form, I have double checked my selector and its correct.

Click() Acting differently to ClickAndHold()/Release()

I am testing an application where the location of a click within an element matters to the outcome.

My original code was:

$actions->moveToElementWithOffset($element, $offset, 0);
$actions->click();
$actions->perform();

I believed that the click within an action chain should be where the cursor has been moved to through the moveToElementWithOffset. However, the code would always trigger as though there was no offset.

Replacing the code with

$actions->moveToElementWithOffset($element, $offset, 0);
$actions->clickAndHold();
$actions->release();
$actions->perform();

My code now functions correctly, and it is triggering as if clicked at the offset.

So I am curious, is it deliberate that click as part of an action chain does not respect the cursor location? If so, is there a more appropriate action I can use for a single click, or should I stick to using the clickAndHold/release pattern?

My current code under test is not open source but if required I will try to mock up a demonstration of this.

I am using Iceweasel 17 and webdriver 2.37.0

Formatter maybe?

Is it the webdriver or is it me? I tried to use the PHP formatter available on the selenium website but none of the two options works with this webdriver. The source code generated therewith can't run.

So is it possible to make a formatter? Or has someone already done it?

Thanks.

deleteWindow() doesn't work

Hi Element-34. I appreciate your work on WebDriver especially cleaning staff up, removing final classes and adding Wait class. I just switched to your source and found that you don't have deleteWindow() method in Session class for some reason, as a result call to Session::deleteWindow() fails with the following Exception

{{{
Exception: window is not a valid webdriver command.

PHPWebDriver/WebDriverBase.php:229
PHPWebDriver/WebDriverBase.php:199
}}}

How to catch Exceptions?

I tried to load an element by class, but it was not found and I get

PHPWebDriver_UnhandledWebDriverError in WebDriverBase.php line 50:
Cannot find matching element locator to: class

How can I even catch this error and do something?

I tried it like this:

use PHPWebDriver_WebDriver;
use PHPWebDriver_WebDriverException;
use PHPWebDriver_UnhandledWebDriverError;

...

    try {
        return $this->driver->element($using, $value);

    } catch(UnhandledWebDriverError $exception) {
            exit("UnhandledWebDriverError: $exception");
    }

But the catch is not executed.

Way to get Text of element?

Hey great work on the library by the way.

I've been looking around and can't seem to find any functionality to get text within an element or an attribute. For example If I was trying to get the text inside a textarea element

Is there are current implementation to do this or will you be adding it in the near future?

Htmlunit error

my code

session('htmlunit', array('javascriptEnabled' => true, 'version' => '3.6')); $session->open("https://github.com/element-34/php-webdriver"); $e = $session->elements('css selector', '.tabs li'); $this->assertEquals(count($e), 0); } } **i get this error** PHPWebDriver_UnhandledWebDriverError: The best matching driver provider org.openqa.selenium.opera.OperaDriver can't create a new driver instance for Capabilities [{browserName=htmlunit, javascriptEnabled=true, version=3.6, platform=ANY}] **question:** I should how to solve it??

Incorrectly constructs URLs (two session IDs in the call)

I'm trying to use php-webdriver to communicate with Appium (which uses the WebDriver Wire Protocol) to test mobile apps. However, I get errors when I try to send requests, and it looks like the URLs are malformed.

Test code:

require_once '../vendor/element-34/php-webdriver/PHPWebDriver/__init__.php';
require_once '../vendor/element-34/php-webdriver/PHPWebDriver/WebDriverBy.php';                                    

class LoginTest extends PHPUnit_Framework_TestCase
{
  protected static $session;

  protected static $server_url   = 'http://localhost:4723/wd/hub';
  protected static $capabilities = array('app' => '/Users/lkung/Documents/iOS/AcceptanceTests/Test.app',
                                         'device' => 'iPhone Simulator',
                                         'version' => '6.1'
                                         );

  public static function setUpBeforeClass()
  {
    $driver = new PHPWebDriver_WebDriver(self::$server_url);
    self::$session = $driver->session('iphone', self::$capabilities);
    self::$session->implicitlyWait(15);
  }

  public static function tearDownAfterClass()
  {
    self::$session->close();
  }

  public function test()
  {
    $element = self::$session->element(PHPWebDriver_WebDriverBy::NAME,
                                       'Log in with Facebook');
    $element->click("");
  }
}

Appium logs:

info: Appium session started with sessionId 5b0446ac-c0ad-4441-9366-361c72783312
POST /wd/hub/session 303 5555ms - 9
debug: Appium request initiated at /wd/hub/session/5b0446ac-c0ad-4441-9366-361c72783312
info: Responding to client with success: {"status":0,"value":{"version":"6.0","webStorageEnabled":false,"locationContextEnabled":false,"browserName":"iOS","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true},"sessionId":"5b0446ac-c0ad-4441-9366-361c72783312"}
GET /wd/hub/session/5b0446ac-c0ad-4441-9366-361c72783312 200 2ms - 319
info: [INST] 2013-09-19 22:36:43 +0000 Default: Set bootstrap config key 'useLocationServices' to true
debug: Appium request initiated at /wd/hub/session/5b0446ac-c0ad-4441-9366-361c72783312/5b0446ac-c0ad-4441-9366-361c72783312/timeouts
debug: Request received with params: {"type":"implicit","ms":15000}
info: Responding to client that we did not find a valid resource
POST /wd/hub/session/5b0446ac-c0ad-4441-9366-361c72783312/5b0446ac-c0ad-4441-9366-361c72783312/timeouts 404 2ms - 47
debug: Appium request initiated at /wd/hub/session/5b0446ac-c0ad-4441-9366-361c72783312/5b0446ac-c0ad-4441-9366-361c72783312/element
debug: Request received with params: {"using":"name","value":"Log in with Facebook"}
info: Responding to client that we did not find a valid resource
POST /wd/hub/session/5b0446ac-c0ad-4441-9366-361c72783312/5b0446ac-c0ad-4441-9366-361c72783312/element 404 1ms - 47

As seen in the logs, the implicit wait request and the element find request respond with the Responding to client that we did not find a valid resource error. The PHPUnit test fails due to Fatal error: Call to a member function click() on a non-object in /Users/lkung/Documents/iOS/AcceptanceTests/tests/test.php on line 30, since the element was not returned.

Looking at where the Appium request came from, Appium request initiated at /wd/hub/session/5b0446ac-c0ad-4441-9366-361c72783312/ 5b0446ac-c0ad-4441-9366-361c72783312 /timeouts, the session ID is present twice.

The error Appium throws for Android (using Selendroid) is slightly different (Proxied response received with status 500: undefined), but still looks like it has the session ID present twice. The PHPUnit test fails the same way - due to "click() on a non-object".

Appium logs:

info: Successfully started selendroid session
info: Waiting for app's activity to become focused
info: Getting focused package and activity
info: Overriding session id with 0049f9d7-8184-4d23-bf20-674bacb5faa0
info: Appium session started with sessionId 0049f9d7-8184-4d23-bf20-674bacb5faa0
POST /wd/hub/session 303 21472ms - 9
debug: Appium request initiated at /wd/hub/session/0049f9d7-8184-4d23-bf20-674bacb5faa0
debug: Proxying command to localhost:8080
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/0049f9d7-8184-4d23-bf20-674bacb5faa0","method":"GET"}
debug: Proxied response received with status 200: "{\"value\":{\"platform\":\"android\",\"acceptSslCerts\":true,\"javascriptEnabled\":true,\"handlesAlerts\":false,\"browserName\":\"selendroid\",\"rotatable\":false,\"takesScreenshot\":true,\"version\":\"0.5.0\"},\"status\":0,\"sessionId\":\"0049f9d7-8184-4d23-bf20-674bacb5faa0\"}"
GET /wd/hub/session/0049f9d7-8184-4d23-bf20-674bacb5faa0 200 21ms - 249
debug: Appium request initiated at /wd/hub/session/0049f9d7-8184-4d23-bf20-674bacb5faa0/0049f9d7-8184-4d23-bf20-674bacb5faa0/timeouts
debug: Request received with params: {"type":"implicit","ms":15000}
debug: Proxying command to localhost:8080
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/0049f9d7-8184-4d23-bf20-674bacb5faa0/0049f9d7-8184-4d23-bf20-674bacb5faa0/timeouts","method":"POST","json":{"type":"implicit","ms":15000}}
debug: Proxied response received with status 500: undefined
POST /wd/hub/session/0049f9d7-8184-4d23-bf20-674bacb5faa0/0049f9d7-8184-4d23-bf20-674bacb5faa0/timeouts 500 36ms
debug: Appium request initiated at /wd/hub/session/0049f9d7-8184-4d23-bf20-674bacb5faa0/0049f9d7-8184-4d23-bf20-674bacb5faa0/element
debug: Request received with params: {"using":"id","value":"button_fbLogin"}
debug: Proxying command to localhost:8080
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/0049f9d7-8184-4d23-bf20-674bacb5faa0/0049f9d7-8184-4d23-bf20-674bacb5faa0/element","method":"POST","json":{"using":"id","value":"button_fbLogin"}}
debug: Proxied response received with status 500: undefined
POST /wd/hub/session/0049f9d7-8184-4d23-bf20-674bacb5faa0/0049f9d7-8184-4d23-bf20-674bacb5faa0/element 500 60ms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.