Selenium RC : Button is not clicked but test passes - selenium-rc

I have a script which enters some data in the page and click save button.
Here I used HTML component id for save button.
selenium.click("StudentID:saveData");
I even provided proper wait condition and also tried with X path locator.
The test passes. It doesn't throw any error message but the button is not clicked and the data is not getting updated.
Please let me know what might be the issue .

I had a similar problem and used a CSS selector instead. CSS selectors are much faster than Xpath (and in my experience work better in general, though Xpath is necessary for certain things).
If you are using Firefox, install the Firebug add-on; right-clicking on an element on the page will give you the option to copy CSS path. I've found that I often have to make some changes to it to get it working properly but it allows you to get to very deeply nested elements quickly.
The W3C has a good page on CSS selectors here.

Related

CKEditor multiple iframe dialog fields show the same dialog

I have created two CKEditor plugins. Each of them uses an "Iframe Dialog Field", meaning that a dialog box is launched and the contents of that dialog box is a webpage (you can think of the entire dialog box as being like one big iframe).
Each plugin works perfectly on its own. However if I use both plugins in the same CKEditor app, they both end up displaying the same page, rather than two different pages, despite the fact that they point to two different pages. I see no reason why this should be happening. Does anyone know how to prevent this?
To make sure there is no confusion, an "IFrame Dialog Field" is a dialog box whose contents are another webpage.
Documenentation - http://ckeditor.com/addon/iframedialog
[ This is different from using an "IFrame dialog", which I believe is a plugin that lets the user add an iframe to the page.
Documentation - IFrame Dialog: http://ckeditor.com/addon/iframe ]
In terms of usage, when using an IFrame Dialog Field, you specify the url of the page to load in the addIframe() command. Here is an example of using a CKEditor Iframe dialog
https://gist.github.com/garryyao/1170303
Back to my issue - if I use just one of the plugins in my CKEditor, it works perfectly. Each plugin points at a different url, and opens that url as the contents of the dialog box. But, if I use both plugins in my CKEditor, although I see a different icon for each, both end up launching a dialog box which points to the same url. Depending which one I launch first, that is the url both end up opening. It is as if you are only allowed to use one IFrame Dialog Field in CKEditor, and the first one used overwrites all others.
This same question was asked a couple of years ago, with no response on the CKEditor forum. The person who asked the question posted his solution, or rather his workaround, which was to NOT use the IFrame Dialog Field altogether, but to instead use a regular dialog and then put an iframe element within it.
http://ckeditor.com/forums/CKEditor-3.x/multiple-iframedialog-plugins-display-same-dialog
That seems like an OK workaround, but it is a workaround and not a solution. I haven't tried it yet, and don't know what potential issues I will run into if I go down that route. I'd prefer to fix my existing code rather than rewrite the plugins, unless I have no choice.
Any help would be appreciated.
Since I have not found any further information, or received any answers here, I ended up going with the workaround mentioned at the end of my question - I used a regular dialogue box and put a big Iframe within it. This problem doesn't exist with that approach, and It looks pretty much the same as an Iframe dialog box. (Considering the almost total lack of community support with CKEditor customization, I've realized it is better to just adjust your design/concept to do what is more easily accomplished with CKEditor, rather than get CKeditor to do exactly what you want).

Qtp element recognition through diff modules

Ok this may be a vague question but I have an issue recognizing a webelement in one module (tab) but works completely fine in another tab. This is the same webelement. Everything seems to be same. It's the same form on the gui side with same properties and values.
Now this is another weird part, I can add one to the object repository but when I go to the other tab and try the same qtp becomes extremely slow. The + sign for adding it to the repository appears but when I click it, it gives me a message saying this object cannot be added to the repository.
The Web app uses extJS if that matters and this is a high level webelement that has a constant html id. I'm just puzzled as to why it works in one module but not the other.
There are also some subtabs where you can click on this form. Those work fine but when it comes to capturing this element the issue persists.
Any hypothesis as to why this is happening?
Okay it looks like it works when I took off the visible identification and just identifying it by the html id. I still don't get why taking the visible made a diff but it works.

mod-pagespeed and tree menu behaviour

We're having a very peculiar problem with a site that is using mod-pagespeed. Here's the link in question -
http://www.microsemi.com/applications/
If you try to expand one of the sections by clicking on the '+' sign you need to click twice to open.
However if you disable pagespeed using http://www.microsemi.com/applications/?ModPagespeed=off
The link works correctly.
What is the best way to debug this ? Is is possible to selectively disable javascripts from being processed by mod-pagespeed ?
I'd start first of all with looking at the errors that are thrown up on the page in chrome console:
Uncaught ReferenceError: Tips is not defined www.microsemi.com:43
Failed to load resource http://www.microsemi.com/media/system/js/mootools-more.js.pagespeed.ce.BqakF5Rbjl.js
These are presumably related as the errors vanish on the second link without page-speed. I'd assume the second one must be the reason why two clicks is needed - for some reason there is a javascript file missing using mod_pagespeed - also presumably containing jQuery UI.
I should probably add that it says here mod-pagespeed only seems to be of use for badly written sites. Joomla is well written so as long as you have well functioning extensions there should be negligible difference on your site!

Methods Supporting Seleneium-Webdriver / Ruby

After hands on Selenium-Client and Watir I have started working on Selenium-Webdriver / Ruby.
However I am not getting any information of the Methods and frequently I am getting stuck in my scripts. Like setting an option in drop down is one of the example. I am not able to get all the elements of webpage.
Frequently I am getting errors like method not found
Can any one help me out by providing the updated list of methods for Selenium-Webdriver with Ruby.
I tried to find relevant information on Net and Forums. This URL contains the Methods however they are also giving the same Error.
I am using selenium webdriver for Automation with Ruby. A very good website is this with lots of info, especially on the use of Excel (automation) together with Ruby. I'm afraid you have chosen the hard way as C# & Java have lots of info and Ruby you need to scavenge the net as resources are limited. Stack overflow has lots of nice examples as well and as Kevin mentioned; it is much easier when you search for a specific error. If I was you I will download a very useful Firefox add-on called Firebug which can be used in conjunction with Selenium IDE. These 2 are very powerful tools that will help tackle most of the things you are getting stuck, at least web-page wise.
Firebug you can use it to inspect any element in a web-page (just right click) and then you can instruct the webdriver to find it via id, link, css or xpath. Xpath is the best when there is no id or css tag. Alternatively what I do when I really get stuck; is to fire up Selenium IDE (record & play) and record the action I want (i.e. choose a value from a drop down menu). Then I export the file into a Ruby script grabbing -only- the code that I need (xpath usually) from there.
Hope that helped. Please post any specific error that is still giving you a hard time and we can take it from there. After you download Firebug, right click the drop box that you want to select and post here the results of the inspect element function. Then I can possibly be of further help on how to select it properly.
Just to give you an idea the xpath should look something like the line below..:
element = driver.find_element(:xpath, "//input[#name='payment']")
Input is the name of the tag obviously . Then you can locate your element by its internal attributes like..: value, name or even type. The above line will put the result of this 'element' search into the variable element. You can miss the 'element =' bit if you are not interested in assigning a variable. However after you find everything you need to locate elements you will realise that you will also need (especially if you are working on automation) a way to control your error handling as web-driver will time-out or crash when it cannot locate an element that has not been already loaded.
I couldn't even tell if anyone's pointed to this documentation yet?
http://selenium.googlecode.com/svn/trunk/docs/api/rb/index.html

Manipulate Html from Firefox Extension

I am creating a Firefox extension that is somewhat similar to Firebug. There is a panel (or vbox) at the bottom of the browser that allows users to specify colors to certain Html elements. When they click the OK button, I would like these colors to get updated on the current web page.
I have my JavaScript working when I click the button (i am just throwing an alert), however when I change that JavaScript to change the css or styles of an element (by either using document.getElementById or jquery), nothing changes.
Is there something with Firefox extensions that I am missing? Any help is appreciated.
Let me know if you have any questions. Thanks
https://developer.mozilla.org/en/Extension_Frequently_Asked_Questions#Accessing_the_document_of_a_webpage_doesn%27t_work
You want content.document.getElementById() and similarly for every other construct you use.

Resources