claudio-vieira / php-webdriver-bindings

Automatically exported from code.google.com/p/php-webdriver-bindings
0 stars 0 forks source link

When using CWebDriverTestCase to run Selenium 1 tests, functions like clear, click, select is unable to locate object if id of the object is not defined #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. $this->open("www.plus.net")
2. $this->click("//a[@href='/broadband']");
3. couldn't click the link

What is the expected output? What do you see instead?
Should find the object and perform action on it

What version of the product are you using? On what operating system?
php-webdriver-bindings-0.9.0.zip . Ubuntu 11

Please provide any additional information below.

I have modified the class CWebDriverTestCase . Please have a look and if you 
feel that the code is upto the standard, it will be great if you can add it to 
you product release.Attached please find the updated copy of 
CWebDriverTestCase.php

Original issue reported on code.google.com by amrita.1...@gmail.com on 6 Dec 2011 at 12:33

Attachments:

GoogleCodeExporter commented 9 years ago
Adding the correct file

Original comment by amrita.1...@gmail.com on 6 Dec 2011 at 12:38

Attachments:

GoogleCodeExporter commented 9 years ago
+1 vote

I was just about to create issue commenting on the lack of locator strategies, 
defaulting to IDs. Good patch here.

One thing I'd like to add, full patch/fix should incorporate all available 
locator strategies. I notice patch omitted CSS selectors, Selenium RC does 
support css selectors following this format: "css=CssSelectorExpression".

And for XPath locator strategy, should account for both cases on how XPath can 
be defined in Selenium RC:

"xpath=//XpathExpression" vs "//XpathExpression_TheShortHandMethod"

So should look for "xpath" or "//".

Original comment by manga...@gmail.com on 7 Dec 2011 at 3:27

GoogleCodeExporter commented 9 years ago
I see a fatal flaw in the patch. startsWith is not a built in PHP function, you 
have to implement it. There is no implementation within the PHP bindings here. 
I don't think its in PHPUnit either.

Original comment by manga...@gmail.com on 10 Dec 2011 at 10:42

GoogleCodeExporter commented 9 years ago
You can add function starts with using this:

function startsWith($haystack, $needle)
{
    $length = strlen($needle);
    return (substr($haystack, 0, $length) === $needle);
}

and then do a $this->startsWith($locator,"id="):

in the switch statement in the patch.

Original comment by manga...@gmail.com on 10 Dec 2011 at 11:01

GoogleCodeExporter commented 9 years ago
I forked the code to include sort of a WebDriverBackedSelenium:

https://github.com/daluu/php-webdriver-bindings

but also, now can really implement WebDriverBackedSelenium using the server 
side feature of WebDriver:

http://seleniumhq.wordpress.com/2012/02/08/announcing-selenium-2-19-the-prancing
-unicorn-release/

https://groups.google.com/forum/?fromgroups#!topic/selenium-users/6E53jIIT0TE

Original comment by manga...@gmail.com on 12 Jun 2012 at 7:43

GoogleCodeExporter commented 9 years ago
Some working code in the fork, now just need to merge code into main/original 
project. And consider using the server-side WebDriverBackedSelenium 
functionality instead of our own wrapper.

Original comment by manga...@gmail.com on 9 Mar 2013 at 6:39

GoogleCodeExporter commented 9 years ago
Deferring merging and further work on this for now since Selenium RC (and thus 
WebDriverBackSelenium) is deprecated functionality. Not quite worth the work to 
invest in plus the PHPUnit-Selenium project now has Selenium 2 support anyways.

Original comment by manga...@gmail.com on 9 Jun 2013 at 3:24