Java vs PHP in webdriver

481 views
Skip to first unread message

Ellie Lock

unread,
Dec 19, 2011, 6:49:35 AM12/19/11
to seleniu...@googlegroups.com
Hello all,

I am very new to testing, and even newer to Selenium (is it pronounced seleenium?).  I am testing an application which is fairly complex, written predominantly using php, with javascript and jquery also liberally used.  The regression tests generally take about 12(ish) man days, so I would like to automate as many as possible.  I have started writing some tests in java as I did a bit of that back in the dark ages when I used to do some dev work), which pulls set up data from an excel spreadsheet, as we are going to want to test various different user access levels, and also different accounts use different labels for the links.  I will also need to test in various differnt browsers, definitely firefox and ie, but preferably chrome as well.  I was producing a report using Ant.  This has taken a lot longer than it probably should as I really am starting from scratch.

The other day I was told that since the app is in php, it would be good to have the tests written in php as they'll be easier to support given that is what the majority of developers here use.  I was a bit daunted as I've never used php before, but set out to look how to do it.  I realise that the bindings are provided by a 3rd party, but it seems to me it's not going to be able to do what I need it to do.

I am going to need to be able to hover over cells in tables which have javascript popups wrapped in a jquery wrapper - and read what is in these popups. I am also going to need to click on a cell, have a context menu appear, and click on that, and then populate the resulting new window.  Is this sort of thing even possible using php?

If it's possible, I'll gladly knuckle down and learn how, but I don't want to change my existing code and start over, if ultimately I'm not going to be able to cover the whole application.

Thanks in advance for any help/advice you can give,
Ellie

Marc Weber

unread,
Dec 19, 2011, 3:36:21 PM12/19/11
to selenium-users
If you want to use a dynamic language also give Ruby a try.

Marc Weber

Mark Collin

unread,
Dec 20, 2011, 4:20:08 AM12/20/11
to seleniu...@googlegroups.com

Personally I would stick with one of the bindings supported by the core selenium dev team, you can be fairly sure that they will be subject to active development and that support isn’t going to tail off at any point in the near future. 

 

I can see some advantages in suggesting you use the same programming language as the dev team but I would counter that with a couple of questions:

 

·         How often does the core dev team help you write your tests (if never why would they suddenly start writing them now)?

·         Is a Java implementation really going to be that hard for professional software developers to understand? 

 

I would suggest that the majority of work is going to be using the selenium API which is pretty easy to pick up (yay for auto complete in IDE’s) so any dev worth their salt should really have no problems.  The bit that is going to take longest is writing the test framework.  Below is a link to my current one on github, I’m sure there are others knocking around as well (the selenium blog is a good place to look) so you can probably find something that meets your requirements with a bit of digging.

 

https://github.com/Ardesco/Ebselen

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/48W35zg34HwJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


-- This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify postm...@ardescosolutions.com

Ellie Lock

unread,
Dec 20, 2011, 7:12:33 AM12/20/11
to Selenium Users
Thanks Mark,

I'll take a look at your framework (thank you!), and have another chat
to the dev manager shortly to see if I can change his mind....

Cheers,
Ellie

On Dec 20, 9:20 am, "Mark Collin" <m...@ardescosolutions.com> wrote:
> Personally I would stick with one of the bindings supported by the core
> selenium dev team, you can be fairly sure that they will be subject to
> active development and that support isn't going to tail off at any point in
> the near future.
>
> I can see some advantages in suggesting you use the same programming
> language as the dev team but I would counter that with a couple of
> questions:
>

> .         How often does the core dev team help you write your tests (if


> never why would they suddenly start writing them now)?
>

> .         Is a Java implementation really going to be that hard for


> professional software developers to understand?
>
> I would suggest that the majority of work is going to be using the selenium
> API which is pretty easy to pick up (yay for auto complete in IDE's) so any
> dev worth their salt should really have no problems.  The bit that is going
> to take longest is writing the test framework.  Below is a link to my
> current one on github, I'm sure there are others knocking around as well
> (the selenium blog is a good place to look) so you can probably find
> something that meets your requirements with a bit of digging.
>

>  <https://github.com/Ardesco/Ebselen>https://github.com/Ardesco/Ebselen
>

Ellie Lock

unread,
Dec 21, 2011, 5:45:44 AM12/21/11
to Selenium Users
Struggling with Maven (as usual). Will try and get a framework
another way. Thanks anyway.

Ellie Lock

unread,
Dec 21, 2011, 10:15:05 AM12/21/11
to Selenium Users
Ok, I've managed to import your framework into Eclipse at last, and
have had a look through some others.  I'm not sure things like
RobotFramework are going to allow me to deal with things like dynamic
fields, but I'm guessing with yours I can...I'm trying to work out how
to use it for my code currently - still very much a newbie at all of
this!
Thanks again,Ellie

Rivlin Pereira

unread,
Dec 21, 2011, 10:25:50 AM12/21/11
to seleniu...@googlegroups.com
Hi Ellie,

I had the same question you have about my app is written in php do i have to write tests in php as well ? i asked this same question to a QA architect in one of the selenium meetups i attended and he said it's ok to write tests in java if your app is written in some other language, mainly because with selenium we are doing functional testing of the web app. The same is not true when you writing unit tests.

Thanks,
Rivlin


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

Rivlin Pereira

unread,
Dec 21, 2011, 10:26:52 AM12/21/11
to seleniu...@googlegroups.com
Hi Ellie,

I had the same question you have about my app is written in php do i have to write tests in php as well ? i asked this same question to a QA architect in one of the selenium meetups i attended and he said it's ok to write tests in java if your app is written in some other language, mainly because with selenium we are doing functional testing of the web app. The same is not true when you are writing unit tests.

Thanks,
Rivlin


On Wed, Dec 21, 2011 at 10:15 AM, Ellie Lock <ellsbe...@googlemail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

Ellie Lock

unread,
Dec 21, 2011, 10:30:13 AM12/21/11
to Selenium Users
Also, I have 2 Maven Dependencies, and JRE System Library's in the
package explorer showing your code. Is this correct? One under
ebselen-core and one under ebselen-tests. 2 x excel files and 2 x css
files. Have I installed something incorrectly?

Ellie Lock

unread,
Dec 21, 2011, 10:31:17 AM12/21/11
to Selenium Users
That's really great - thanks Rivlin!

On Dec 21, 3:26 pm, Rivlin Pereira <rivlin.pere...@gmail.com> wrote:
> Hi Ellie,
>
> I had the same question you have about my app is written in php do i have
> to write tests in php as well ? i asked this same question to a QA
> architect in one of the selenium meetups i attended and he said it's ok to
> write tests in java if your app is written in some other language, mainly
> because with selenium we are doing functional testing of the web app. The
> same is not true when you are writing unit tests.
>
> Thanks,
> Rivlin
>

emily

unread,
Dec 21, 2011, 10:48:23 AM12/21/11
to Selenium Users
Hi Ellie

Have you come across the Selenium IDE yet?
http://seleniumhq.org/projects/ide/

You can use this in your browser (firefox preferred) to record your
mouse movements as a test.

My colleague and I adapted this IDE to export as an XML file and we
use PHP Webdriver to upload to a dashboard we created that can then
run all of the IDE recorded tests run using PHP Webdriver.

I guess that you could do something similiar with the IDE, it would
certianly save you some time, as you can record your tests rather then
write them out in JAVA, you could export them as PHP/XML/HTML or
whatever.

Emily

Ellie Lock

unread,
Dec 21, 2011, 10:57:50 AM12/21/11
to seleniu...@googlegroups.com
Hi Emily,

I have seen and considered it.  But the following things are stopping me from using it ;

  1. I didn't think (until your post) that I'd be able to export as php
  2. It stops recording when dealing with the jquery hover overs we have littered all over our application
  3. Our application has different accounts which use different naming structures which I believe would mean I'd have to record a test for each one.
  4. Our application makes prolific use of dynamic fields, which I don't think the IDE handles particularly well.
If I'm wrong, and in actual fact the IDE would handle all of the above with ease, then please let me know and save me hours of coding :o)

Cheers,
Ellie

emily

unread,
Dec 21, 2011, 11:25:12 AM12/21/11
to Selenium Users
Hi Ellie

Ok, we did come across a few issues with the IDE at first but we have
AJAX and dynamic fields on our sites too and the IDE works fine for
us.

1. There is a PHP Formatter extension out there that you can add onto
the IDE, but we found that exporting as an XML file was easier for us,
and we simply parse through that on our dashboard and turn the IDE
commands into Webdriver commands.
2 and 4. You may need to put some sleeps or waits in for dynamically
generated fields, or to wait for JQuery to populate certain things, I
have never come across any instances of the IDE stopping recording mid
way through a test.
3. Yes I am afraid that you would have to record different tests for
the difference accounts, but once you have recorded them you can save
them in the IDE and re run them or export them in whichever format you
like and run them via Webdriver. (we are doing the latter).

Another good thing about the IDE is the fact that you can order the
Locator Builders and if you put all the xpath locators at the top of
the list, then you shouldnt have too many problems finding elements
which have an id or name.

Here are a few links that may help you with the exporting in different
formats:
https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-php-formatters/
https://addons.mozilla.org/en-US/firefox/addon/selenium-xml-formatter/

Hope that this helps you, anything to help make it easier and take
less time for you!

At the beginning we were writting our own tests manually, but once we
found the IDE we didnt look back! :-)

Thanks
Emily

On Dec 21, 3:57 pm, Ellie Lock <ellsbells...@googlemail.com> wrote:
> Hi Emily,
>
> I have seen and considered it.  But the following things are stopping me
> from using it ;
>
>    1. I didn't think (until your post) that I'd be able to export as php
>    2. It stops recording when dealing with the jquery hover overs we have
>    littered all over our application
>    3. Our application has different accounts which use different naming
>    structures which I believe would mean I'd have to record a test for each
>    one.
>    4. Our application makes prolific use of dynamic fields, which I don't

Mark Collin

unread,
Dec 21, 2011, 11:52:42 AM12/21/11
to seleniu...@googlegroups.com
I'm guessing this is aimed at me.

ebselen-tests should have two xls files under the test folder which are used
in test tree and one css file used in the main tree.

The CSS file is used by the HTML report generated by the tests when they are
run and the xls files are used in the data driven test examples.

You don't need the xls files if you delete the website.google and
pagefactory.google packages. If you delete the CSS file the test reports
generated by tests tagged with the @SeleniumTest annotation will have no
styling.

-----Original Message-----
From: seleniu...@googlegroups.com
[mailto:seleniu...@googlegroups.com] On Behalf Of Ellie Lock

--


You received this message because you are subscribed to the Google Groups
"Selenium Users" group.

Ellie Lock

unread,
Dec 21, 2011, 11:55:03 AM12/21/11
to seleniu...@googlegroups.com
Emily,

Thank you very much - that's really useful and good to know.  I have installed the xml plugin, and I assume when you talk about php-webdriver you are talking about the facebook wrapper?  Before I get too excited though(!) I've just had a quick run through the main section of my app, and I can't get the IDE to recognise that I'm hovering over my hoverovers (iyswim).  One thing I'm definitely going to need to do is check that they are displaying the information we are expecting.  You can't click on them.

I'm also intrigued to know how it will deal with the dynamic fields, so am off to have a closer look at that too.

Thanks again,
Ellie

Mark Collin

unread,
Dec 21, 2011, 11:55:47 AM12/21/11
to seleniu...@googlegroups.com
Once you have got used to writing tests in Java (or any other supported
language) you will find it's actually quicker than using record and play.
Complex tests tend to require quite a bit of tweaking to make them work when
run multiple times, you usually end up rewriting them completely. I would
highly encourage binning IDE and learning to write tests directly in your
programming language of choice.

It will be slower at first but in the long run it's much quicker.

-----Original Message-----
From: seleniu...@googlegroups.com
[mailto:seleniu...@googlegroups.com] On Behalf Of emily
Sent: 21 December 2011 15:48
To: Selenium Users

Hi Ellie

Emily

Ellie Lock

unread,
Dec 21, 2011, 11:58:33 AM12/21/11
to seleniu...@googlegroups.com
Thanks Mark, I guess I wasn't specific enough - my bad.  I meant that there are 2 x DataDriven.xls files - it confused me slightly at first as I changed the values and the tests didn't change.  Once I'd changed the other DataDriven.xls it worked fine.  The same for the css files.

Rivlin Pereira

unread,
Dec 21, 2011, 11:58:29 AM12/21/11
to seleniu...@googlegroups.com
I second mark here

Ellie Lock

unread,
Dec 21, 2011, 12:19:41 PM12/21/11
to seleniu...@googlegroups.com
Mark,

My gut instinct is to stick with the java - I can't believe that the ide will be more powerful\efficient.  However - I would like to know that I've got your framework set up correctly with regards to the doubling up on datadriven.xls and the css files.

Big thank you for taking the time to reply.  There is just so much to consider when starting out for the first time!

Cheers,
Ellie

Mark Collin

unread,
Dec 21, 2011, 4:05:27 PM12/21/11
to seleniu...@googlegroups.com

No I’m not seeing that…

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/-KELDknft_sJ.


To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

David

unread,
Dec 22, 2011, 12:32:18 AM12/22/11
to Selenium Users
There's also Python, good with Robot Framework as OP mentioned in one
post here.

David

unread,
Dec 22, 2011, 12:43:44 AM12/22/11
to Selenium Users
Just wanted to chime in...

My company is in the same boat, and we have established Selenium (RC)
test codebase in PHP, but we'll most likely have to move to Java for
the full support and support for stuff like iPhone and Android
drivers.

and as most people will say and agree, you'd want to go with one of
the supported languages, ideally Java.

However, I must also say that after working with some of the PHP
bindings for WebDriver, and going over the JSONWireProtocol, I must
say that whatever you can do in Java or one of the other supported
languages is not entirely impossible to do in an unsupported language.
It just means much more work to implement the needed functionality
yourself until the third party developers are able to catch up and
beef up the third party offerings. And work to debug issues that arise
as well.

Unless the core Selenium dev team forsakes JSONWireProtocol, because
at present, it seems to have much of what is needed for WebDriver, you
just have to write code to interface to it for unsupported languages
to get the WebDriver functionalities.

Having reviewed the PHP bindings, the one at Google Code provides the
best user interface / API to make use of WebDriver. It's easy to
understand and extend. I've even worked on creating a
WebDriverBackedSelenium PHP class based off that, which works pretty
well, though not yet complete but pretty near complete. So you don't
actually need to use Java for WebDriverBackedSelenium. And the
Facebook PHP binding offers the best API that directly maps to
JSONWireProtocol, but most QA users probably want an API that's more
user friendly like the Google code version.

My two cents.

On Dec 20, 1:20 am, "Mark Collin" <m...@ardescosolutions.com> wrote:
> Personally I would stick with one of the bindings supported by the core
> selenium dev team, you can be fairly sure that they will be subject to
> active development and that support isn't going to tail off at any point in
> the near future.
>
> I can see some advantages in suggesting you use the same programming
> language as the dev team but I would counter that with a couple of
> questions:
>
> .         How often does the core dev team help you write your tests (if
> never why would they suddenly start writing them now)?
>
> .         Is a Java implementation really going to be that hard for
> professional software developers to understand?
>
> I would suggest that the majority of work is going to be using the selenium
> API which is pretty easy to pick up (yay for auto complete in IDE's) so any
> dev worth their salt should really have no problems.  The bit that is going
> to take longest is writing the test framework.  Below is a link to my
> current one on github, I'm sure there are others knocking around as well
> (the selenium blog is a good place to look) so you can probably find
> something that meets your requirements with a bit of digging.
>
>  <https://github.com/Ardesco/Ebselen>https://github.com/Ardesco/Ebselen
> To view this discussion on the web visithttps://groups.google.com/d/msg/selenium-users/-/48W35zg34HwJ.
> To post to this group, send email to seleniu...@googlegroups.com.
> To unsubscribe from this group, send email to
> selenium-user...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/selenium-users?hl=en.
>
> --
> This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.
>
> If you have received this email in error please notify postmas...@ardescosolutions.com

Henry S. Thompson

unread,
Dec 22, 2011, 9:33:50 AM12/22/11
to seleniu...@googlegroups.com
emily <emily...@googlemail.com> writes:

> the IDE, but we found that exporting as an XML file was easier for us,
> and we simply parse through that on our dashboard and turn the IDE
> commands into Webdriver commands.

So you are not using Selenium 2.0? I haven't been able to find any
documentation on how to connect from the IDE to 2.0. . .

> Here are a few links that may help you with the exporting in different
> formats:
> https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-php-formatters/
> https://addons.mozilla.org/en-US/firefox/addon/selenium-xml-formatter/
>
> Hope that this helps you, anything to help make it easier and take
> less time for you!

Me too, I suspect -- what are you using to get from your parsed XML to
WebDriver?

> At the beginning we were writting our own tests manually, but once we
> found the IDE we didnt look back! :-)

I'm still stuck with a manual setup, based on the Kolczynski php
interface, plus my own shims to make it work pretty seemlessly with
more basic simpletest unit tests of my app's underlying PHP.

If you or anyone else has a pointer to some basic documentation on the
relationship between the JSON wire protocol and IDE output, that would
be hugely helpful. . . As far as I can see, the IDE has access to
some functionality which simply isn't exposed via the wire protocol,
which makes me think I must be missing something.

ht
--
Henry S. Thompson, Markup Systems Ltd.
Cavers Garden Farm, Denholm; by Hawick; TD9 8LN
+44 (0) 7866 471 388
Fax: (44) 131 651-1426, e-mail: h...@markup.co.uk
URL: http://www.markup.co.uk/
[mail really from me _always_ has this .sig -- mail without it is forged spam]

Reply all
Reply to author
Forward
0 new messages