CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Might interest you: Automating configurations with Selenium and Ajax!
Pages: [1]

Author Topic: Might interest you: Automating configurations with Selenium and Ajax!  (Read 950 times)

marc

  • Guest
Might interest you: Automating configurations with Selenium and Ajax!
February 15, 2010, 09:04:11 am
Hi,

this question is for Michal or anyone knowing how he solved the issue of waiting for Ajax requests when using Selenium.

Michal, you said you solved the Ajax problem - waiting for the Ajax request - in one of your Selenium tests, where is the code for that again?

To give a bit of background: at the DeveloperCamp in Brussels last week, Ludovic (I think) said that they are using Selenium to autoconfigure websites, since Selenium can be used to click it's way around pretty fast and reliably. Xavier thought this might be handy, so I looked into this and it is pretty neat indeed! Have a look at this to see if it might be for you.

Except, that Ajax is difficult to cope with and doesn't allow me to be lazy...

Marc

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Might interest you: Automating configurations with Selenium and Ajax!
February 15, 2010, 09:36:51 am
Thanks for sharing this Marc! I thought it was going to be a great idea for localization that needs to be done after the CiviCRM standard localization, and settings for vertical industries. It is definitly on my to do list (with too many other things as usual). Keep me posted!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

MichaƂ Mach

  • Ask me questions
  • ****
  • Posts: 748
  • Karma: 59
    • CiviCRM site
  • CiviCRM version: latest
  • CMS version: Drupal and Joomla latest
  • MySQL version: numerous
  • PHP version: 5.3 and 5.2
Re: Might interest you: Automating configurations with Selenium and Ajax!
February 24, 2010, 07:23:42 am
Marc,

In general, the rule is simple - after invoking some Ajax event, you need to wait for some HTML element that is supposed to show-up. Practical example:

$this->typeKeys("//form[@id='Activity']/fieldset/table/tbody/tr[3]/td[2]/ul/li/input", "Anthony");
$this->waitForElementPresent("//form[@id='Activity']/fieldset/table/tbody/tr[3]/td[2]/div/ul/li[1]");

Full example, with comments is here:
http://svn.civicrm.org/civicrm/branches/v3.1/tests/phpunit/WebTest/Activity/StandaloneAddTest.php

If you let me know which specific situation you're talking about, I might be able to help with more detailed recipe. :-)

Thx,m
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

My absolute favourite: Wordpress Integration!.

Donate Now!

marc

  • Guest
Re: Might interest you: Automating configurations with Selenium and Ajax!
March 22, 2010, 07:40:16 am
Hi,

the exact situation is that I want to use Selenium to add new Tasks for me automatically - yes I am that lazy -, with me just typing in the title of the task. The Ajax comes in when (in <your-site>/civicrm/activity?action=add&reset=1&context=standalone) I want to pick someone else as contact person, say Michal. So I type 'Michal' in the "With contact" field and wait for the ajax to come back with the dropdown list.

I'll try out your solution and tell you whether I got it to work!

Marc

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Might interest you: Automating configurations with Selenium and Ajax!

This forum was archived on 2017-11-26.