MbUnit Gallio WatiN Right-Click Testing on a link - watin

I want to test right click on a link by using MbUnit, Gallio and WatiN. Currently I can not see what is the way to do that. It seems that there is no method for right click which I can call from the framework. I am sure that there is a workaround, which I was not able to find currently.

In WatiN, you might need to fire event directly, such as
myElement.FireEvent("oncontextmenu")
Also look at:
WatiN FireEvent not passing event properties in FireFox
In selenium WebDriver, you can Use the Actions class.
In C#,
IWebElement element = driver.FindElement(By.LinkText("LinkText"));
Actions actioner = new Actions(driver);
actioner.MoveToElement(elem).ContextClick(elem).Perform();

Related

How to programmatically open a website and click buttons

How to use VBScript to implement the following:
Open web browser
Load a URL in web browser after opening
List item
Click buttons in the loaded browser
Is this possible using VBScript. Any examples of code to help get me started would be beneficial. Also, my web browser is Chrome.
There is a Selenium webdriver created that works with VB.NET, VBA, and VBScript. Download and install the exe.
There are also lots of example scripts that show loading different browser types or in your case Chrome. Once loaded you just need to program what elements to navigate and click after loading your specific URL.
There might be other ways to launch and run commands against the web browser using VBScript. This is just one way.
SeleniumBasic v2.0.9.0 created by Florent Breheret and open source via git hub.
A Selenium based browser automation framework for VB.Net, Visual Basic Applications and VBScript
Script Example:
Set driver = CreateObject("Selenium.ChromeDriver")
driver.Start
WScript.Echo "Click OK to quit"
driver.Quit
Here is the official SELENIUM page: selenium main page
UPDATE:
Here is a second option that is based on the same concept , but implemented a little different. I am not sure it meets your needs , but thought I would include it as another example.
VBS WebDriver
Examples using the VBS WebDriver which is intended to provide a simple binding for Selenium 2. The bindings include the full functionality of Selenium 2 (WebDriver).
If you press F12 in Internet Explorer you can lie about what browser you are using. Use the compatibility tab (a downward direction play icon) and enter your UA string for a browser they support.
See https://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx

Use selenium IDE to change Firefox Preferences for SDK Addon testing

I am using Selenium IDE to test some behavior in my FireFox SDK Add-On. For example, I load a page and determine that the content script is executing at intended. In my plugin, I use simple-prefs to set some user defined preferences.
For example, I would like to load a page and then ensure that if a preference is changed, that the content script received the update and made the necessary changes to the page based on the new setting.
when I try to navigate with Selenium-IDE to the plugin configuration page chrome://mozapps/content/extensions/extensions.xul?type=extensions / about:addons. I am able to use Selenium to select an entry (<richlistitem />), but I cannot click any of the buttons within the entry because they are not part of the XUL dom. I have tried using Selenium to send enter, tab, clicks, double clicks to the appropriate <richlistitem /> but there is no way of interacting with the "inner part" of the item.
I have also tried going down the path of using selenium to modify entries via about:config, however, the area with all of the entires is just an XUL <treechildren /> and you have no way of targeting individual entries.
Is there a convenient way to change addon setting as part of an automated workflow with selenium-ide?
It seems you should use Selenium Web driver , by driver you can set preference

Watin UploadiFy

I am using WatiN for browser automation. But today i ended up in a problem where i need to call the flash object (uploadify button) in my asp.net page.
This code seems working fine, but doesn't show any actions
Element ele = window.Element(Find.ById("uploadifyUploader"));
ele.Click();
Is there a way to achive this in WatiN.?
Watin is not able to access flash objects.
You can try AutoIt library.
Or use javascript library. For example this: http://www.permadi.com/tutorial/flashjscommand/

How to handle pop up/lookup windows in selenium

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();

Selenium IDE and telling it to record actions

I am trying to make a little application to allow to record actions within a Flash and Silverlight application. In such manner that you can compile your interactive application in test-mode and then be able to click on elements which then passed the action to Selenium IDE which then adds this command to the testcase.
I am curious if this even possible and how I can achieve this in Firefox?
There is a new plugin for Se-IDE called 'Flex Pilot X' which works with External Actions exposed through Flex Pilot. Adam Christian (who wrote it) demonstrated it at the SFSE meetup last month; which was recorded and viewable at http://saucelabs.com/blog/index.php/2010/04/highlights-from-our-april-20th-selenium-testing-tools-demo-night/
-adam

Resources