AttachToIE seems to be non-existent in the WatiN 2.0 RC - watin

IE.AttachToIE(Find.ByUrl("my url") seems to be non-existent in the WatiN 2.0 RC candidate. It does exist in 1.3. How can I fix it in 2.0?

Try this:
IE.AttachTo<IE>(Find.ByUrl("my url"))

Browser ie = Browser.AttachTo(typeof(IE), Find.ByTitle(new Regex("Window Title.*")));

Related

Firefox - How to disable auto-redirect, auto-refresh?

i am using newest version of Firefox.
I would like to block all auto-redirects and auto-refreshes, is it possible? I did not find anything similar in about:config.
Thanks in advance.

How to Maximize a firefox browser window using Selenium WebDriver with node.js

How do we maximize a firefox browser using Selenium WebDriver (Selenium 2) with node.js. I am using wd package for Selenium WebDriver to write the tests. I have tried executing window.resizeTo(1366,768); usin eval or execute but didn't work.
I am using Selenium WebDriver 2.25.0
Have you tried :
driver.manage().window().maximize()
Doc
First instantiate a firefox driver
WebDriver driver = new FirefoxDriver();
then maximize it
driver.manage().window().maximize();
Use this code:
driver.manage().window().maximize()
works well,
Please make sure that you give enough time for the window to load before you declare this statement.
If you are finding any element to input some data then provide reasonable delay between this and the input statement.
driver.manage().window().maximize();
Try this working for Firefox:
driver.manage().window.maximize();
If you are using Selenium WebdriverJS than the below code should work:
var window = new webdriver.WebDriver.Window(driver);
window.maximize();
Call window as a function.
driver.manage().window().maximize();
The statement :: driver.manage().window.maximize(); Works perfectly, but the window maximizes only after loading the page on browser, it does not maximizes at the time of initializing the browser.
here : (driver) is called object of Firefox driver, it may be any thing depending on the initializing of Firefox object by you only.
driver.Manage().Window.Maximize();
Try this:
self.ff_driver = Firefox()
self.ff_driver.maximize_window()
One way, everyone already have written in thier answers:
driver.manage().window().maximize()
but if you looking for alternative ways, here you are:
driver.manage().window().setSize(screenResolution);
or
driver.findElement(By.id("......")).sendKeys(Keys.F11);
driver.manage().window().maximize() ;
works perfectly and at the very beginning it maximizes the window. Does not wait to load any page.
As of 2020, the correct answer is :
driver.maximize_window()

Is something wrong with Firebug and Firepath?

My Firebug and Firepath were working fine, but they just started acting strange. When I click on objects on webpage, and do Inspect Element, it just does nothing. I didn't update or do anything on firefox. Anyone else having similar issues?
Well I tried the next release 1.8.1b1 and it still failed. I reinstalled 1.7.3 and its working again. Here is the link:
Addon Firbug 1.7.3 Download
and the versions page:
https://addons.mozilla.org/en-US/firefox/addon/firebug/versions/
It's ok now,firepath 0.9.7 is compatable with firebug 1.8

Paypal-Sandbox buying with Selenium RC

I'm trying to buy something at Paypal-Sandbox with Selenium RC (Java), but it doesn't work.
I tried it with Selenium IDE (Firefox AddOn) and it did work. I changed the viewing and copied the JUnit 4 Code and it still doesn't work.
The problem is the part with the radio-button "payment_type_paypal". Somehow it doesnt work in RC (the radio-button is not checked). Do someone have similiar experiences and/or resolved the issue?
After loging in to developer.paypal.com and entering the homepage...
//linking homepage
selenium.click("legalTerms");
selenium.click("pay");
selenium.waitForPageToLoad("30000");
//leaving homepage and switching to paypal
selenium.click("payment_type_paypal"); // <===== point of error
selenium.type("login_email",username);
selenium.type("login_password",pw);
Thx :)
its me againg, Krzys. I know now the Problem. Its an issue with focussing the correct frame. I couldn't get it work with Selenium RC.
You can easily fix the issue in Selenium WebDriver with the command, before my "point of error":
driver.switchTo().defaultContent();
its me again. If you encounter problems with the Sandbox System of Paypal, you can overcome the "submit"-button issues using xpath.
driver.findElement(By.xpath("//div[#id='nav-menu']/form/ul/li/ul/li[6]/input")
Greetz
Krzys

Watin - IE8 hangs on FileUpload.Set

Whenever I call FileUpload.Set, IE8 will open up the file browser window and just sit there without typing any text. This is on Windows XP and it used to work just fine until I upgraded from Ie7 to IE8. Anyone else run into this?
Turns out this line in the WatiN source was the problem:
if (Process.GetProcessById(window.ProcessID).ProcessName != "iexplore") return;
For some reason, the iexplore process on this machine appears as "IEXPLORE", in all caps. Adding a .ToLower() to the process name fixes the problem.
edit: looks like this bug has already been reported.
Because of the way WatiN looks for the dialog box (by style number), it's understandable that IE8 would be broken in versions less than 2.0. You may want to try it with the 2.0 beta.
Alternatively, you can dive the style numbers on the FileUpload DialogHandler and add the style numbers for IE7 and 8 (96CC20C4 and 96CC02C4).
I'd like to post an update for this problem since it came up again in Win7 OS.
If you have the same problem in the latest WatiN release you can override the function CanHandleDialog in the FileUploadDialogHandler class:
public override bool CanHandleDialog(Window window, System.IntPtr mainWindowHwnd)
{
return true;
}
It's not a clean solution but it is the simple and works.

Resources