I am using WATIN Version(1.3.0)
I am in a situation that when i click on a node ,a Wizard appear. That wizard contain several controls(checkboxes,buttons and TextFields) and it has many screens(when next button is pressed , the next screen appear) but i am unable to handle it. I have apply the following techniques but failed
I have used ie.HtmlDialog but exception appear
I have grab the internal iframe (which is the main frame) but its HTMLDocument contains nothing. Where as i contain HTML when i look into it using IE8 Developer Tool
I have tried to use mshtml.HTMLDocuemntClass but failed
Wizard has url but unable to grab it by url
Unable to grab it by using ie.Form
Please HELP !!!
Thankx in Advance
Is the wizard held in an update panel or anything that is AJAX enabled? if this is then WatiN will not realise that the page has actually refreshed and will therefore not be able to find some of the elements it is looking for
Paul
Related
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!
This is a real 2%er but here goes, I have created a winform in VS2010 with Gecko 2.0.1-0.10 (latest release) webbrowser control, I am using a touch screen to navigate. Sometimes when clicking a hyperlink it will select text rather than navigate, on the DomMouseUp event I want to check to see if there is selected text, if so I want to see if it is a hyperlink and if it is, where that hyperlink goes to. I had a mess around with GeckoSelection but nothing looked obvious. I am looking for a way to see if what is selected within the web browser is a hyperlink, any thoughts?
I've worked it out : for anyone interested in such things, use DomFocus on the gecko control:
m_strInnerHtml = geckSel.ActiveElement.Parent.InnerHtml.ToString();
That will give you the innerhtml of the selected item, from here you can extract the href tag and get the url, navigate to it, hey presto :)
Update: An even better solution is to use (in DomFocus again)
m_strInnerHtml = geckoWebBrowser.Document.ActiveElement.GetAttribute("href");
This will return the actual hyperlink address, one thing to watch out for however is if you're on google for example and select the "Advertising" hyperlink at the bottom of the page, it may return "/advertisingpage/" which must be appended to the original url. Clicking a hyperlink away from google will return the full address however.
Very good behavior gives this call:
m_strInnerHtml = geckoWebBrowser1.Url.AbsoluteUri()
I am doing some web automation using Selenium RC. Am new to Selenium RC and am facing problems (may be learning curve) while doing automation. I am using java with Eclipse IDE to code selenium RC.
Scenario: I have a screen with a link. while clicking, it will open a lookup window which contains lot of names (grid). Now I have to select a value from grid by directly clicking any row/record. Or I can use search option and select the record. The problems are
my recorded script is NOT responding to pop-up windows.
Is there any command for "double-click" in selenium.
#rs79 - It didn't work for me. Here is my code:
selenium.click("link=eName"); //click the link to open the lookup window
//lookup window
selenium.focus("Associate"); <br>
selenium.waitForPopUp("Associat", "20000");
selenium.selectWindow("Associat");
selenium.type("id=SearchTextBox", "xyz"); //Enter the text in search field of lookup
selenium.click("id=SearchButton"); // click search button on lookup window <br>
Please correct me if I am wrong. Appreciated if anyone give me more suggestions.
Without access to your DOM, I would recommend recording using the IDE, and adapting the right context from the recorded actions into RC. The IDE does a decent job of capturing the context for popups and modals.
After the capture, here are some gotchas:
For iFrames, change the captured frame id to a more generic (css) locator
Be wary about the difference between selectWindow() and selectFrame()
If its a popup not an popup window then you can try the firebug to locate the element or record you want.
Now copy its xpath and use it in your code.
Same problem I have faced and solved by this method as xpath from fire bug is detailed and locates the proper window.
After coping xpath please verify the path has // at starting.
Thanks
This will help to handle salesforce lookups
Iterator it = windows.iterator();
String parentwindow =(String) it.next();
String childWindow =(String) it.next();
// Switch to parent window
driver.switchTo().window(childWindow);
MiscUtils.pauseForElementToBePresent(3000L);
driver.switchTo().frame("your frame NAME/ID");
MiscUtils.pauseForElementToBePresent(3000L);
// your step to perform on child page.
driver.findElement(By.linkText("123Test")).click();
MiscUtils.pauseForElementToBePresent(3000L);
//if popup is getting close automatically switch to parent window otherwise use "driver.quit();" to close popup
driver.switchTo().window(parentwindow);
driver.switchTo().defaultContent();
I have seen in this application a popup windows with a form inside.
Can anyone help me build a popup windows like that, or if there is any tutorial where I can see how it's done.
There are some modal form plug-ins like this one on Apex-Plugin.com. I haven't used them myself so cannot vouch for them.
Alternatively, use your browser's "View Source" function on the Apex page you like and you will see all the function definitions and where they are called. It appears to just be using the standard JQuery libraries that come with Apex 4.0
Update 04/10/2011:
I have recently used this modal page plug-in, and can recommend it. There is plenty of instruction, including a half hour YouTube video showing how to use it.
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.