Has anyone found a means to press tab with watiN in Internet explorer?
Do you mean you want to press the tab key itself, or just click on an HTML element that looks like a tab? For the latter use the Click method against the appropriate element (Div, Span etc). Otherwise you could try SendKeys instead of PressTab. e.g.:
IE ie = new IE("http://www.google.com");
ie.AutoClose = false;
ie.TextField(Find.ByName("q")).Click();
SendKeys.SendWait("{TAB}");
The above example will set the focus the text field then tab off, putting focus on the search button.
we had the same problem, we resolve it focusin on the browser and using SendMessage (Win) to the specific hwnd.
Related
Internet Explorer is open and it is showing a webpage. We know there a drop down and a textbox and a button are exist in this page.
I need to select an item from drop down, writing a text in textBox and clicking on that button.
How Can I do these using WatiN by pressing on a button in windows form, I currently add its related libraries and I have add WatiN.Core in using section, but it seems it is not working with windows forms.
This is a very small example but not sure what you mean by "not working" (does it throw an exception, are you able to start the program, when you click the button it fails, you need to be more precise on this).
using(var ie = new IE){
ie.GoTo("http://www.yourwebpage.com");
TextField entry = ie.TextField(Find.ById("myEntryBox"));
Button btn = ie.Button(Find.ById("submit"));
SelectList menu = ie.SelectList(Find.ById("selectList"));
entry.Value ="Hello world");
menu.SelectByValue("2");
btn.Click();
}
if you are having other problems, please, let us know.
I am trying to create a popup but when it is open it is still possible to use the tab key to switch the focus to an element in the background (e.g. to a button and use space to press is). The only way I found until now is to check on every lostFocus event (which also fires for every element contained in the Border element) and check if the focus is now in a element inside the Border. If not I manually set the focus.
Is there a nicer way to keep the focus within the Border (or a Grid,...)
I'm working on a Windows 8 App.
Do you mean that using a Modal Dialog with Form.ShowDialog(Owner) still allows you to focus the parent components with Tab?
Can you give a sample of your code call?
Form2 form = new Form2(); //Make an instantiation of your Form
form.ShowDialog(); //ShowDialog()!!! NOT form.Show()!!! Or anything else :/
A few ideas:
Set Enabled to False on the background visual tree, though that might change the way things look if you still want to show them partly
Set IsHitTestVisible to False to disable pointer input
Use RenderTargetBitmap.Render() if targeting Windows 8.1 to render the content of the background to an image and simply replace all that visual tree with an image of it
Here is HTML code :
<script type='text/javascript'>//<![CDATA[
window.onload=function(){
alert('hi');
}//]]>
</script>
Not only alerts, popups, new tab, new window but anything cause focus change.
By other words I don't want WebBrowser control to get focused or change current focus.
Looking for a solution that doesn't hurt any weppage( I need javascript enabled).
In theory, you should implement IProtectFocus, but apparently there're issues with it:
http://social.msdn.microsoft.com/Forums/windows/en-US/211733a0-af84-4cc4-9851-2f19def7aedd/iprotectfocus-and-allowfocuschange-not-working-on-webbrowser?forum=winforms
Another option might be to implement a CBTHook, handle HCBT_SETFOCUS and reject it (return 1 to prevent it) if the window becoming focused is a child window of the WebBrowser object.
Disclaimer: I myself haven't tried either of the above.
When I click on a button on a page, a popup is displayed. This is not a windows popup. It is the application popup.. The popup I get in my application is similar to the one i have shown in the image with a X button. now How do I move the driver control to the popup and then click on the close button available on the popup and then move back my control back to the original page..
I have to do this using Selenium WebDriver and C#.
You need to do the following...
Loop through the windows and find the desired window
Switch to the windows
Find the button in the current window and click the same
Here is the sample code in C#
foreach (string handle in browser.WindowHandles)
{
IWebDriver popup = driver.SwitchTo().Window(handle);
if (popup.Title.Contains("popup title"))
{
break;
}
}
IWebElement closeButton = driver.FindElement(By.Id("closeButton"));
closeButton.Click();
The new pop message too have an id or class name..
First get the class name or id of that pop up and the go for the xpath(may be we will find class name) of the close button and click on it.
The example you have shown is not a popup, but a simple DHTML window.
To access the X of the example you have provided, you could use: driver.findElementBy(By.id("profile-tooltip-closebtn")).click().
You can try
driver.switchTo().frame(0);
Really like the free Dockpanelsuite.New to it and was wondering if possible.
I would like to hide the x and down arrow + tabheader
Is this possible?
Thanks
The close button can be hidden on a per-DockContent basis via the CloseButtonVisible property of the DockContent.
Currently the window list button cannot be hidden as easily. I have logged a new feature request for this option: https://github.com/dockpanelsuite/dockpanelsuite/issues/29
Hide the close button using CloseButtonVisible property for the DockContent.
content.CloseButtonVisible = false;