How can i automate sharepoint people picker with watin - c#

I'm new in automated testing (Watin for IE) and i came across with some issues automating the People picker of sharepoint. I can't take the controls within the pop up because the pop up blocks main page (blocking also Intenet Explorer Developer Tools). Someone knows how can i do it or at least the name of the controls for IE?
Thanks

If it is a modal dialog that is getting you bothered, you can try this.
Open the SharePoint site in Firefox and then open the People-Picker. In firefox you would have the URL displayed for the modal dialog too. And from there you use the URL to open it in a new browser tab directly and use a web development tools plugin to view the DOM.

Related

How can I control Google Chrome browser without Selenium, or other webdrivers?

I'd like to develop a software, which can start Google Chrome events (like next page, previous page, go to a specific url, open a new tab etc...) without Selenium Webdriver. It's very important!!! I don't want to use Selenium, I'd like to control existing chrome processes.
How can I do this with C# interop services?
How can I fetch JavaScript code into my chrome browser, to solve this problem?
Where can I find a tutorial about this?
Which solution is the best?
Probably it's not a too complicated problem, but I tried a ton of google search keywords already, but I haven't found anything.
You can control Chrome or any other application with UI Automation
(I use Automation Core with reference to c:\Windows\system32\UIAutomationCore.dll)
Use Inspect tool from SDK to see the hierarchy of controls and various properties
IUIAutomation::ElementFromHandle to get IUIAutomationElement from Chrome main window and so on (tested on Windows 10 in C# with Google Chrome Version 74.0.3729.169)

Find and Close a Dialog in Firefox using Selenium and C#

Issue: My selenium script is not recognizing and closing a dialog box that pops up when I redirect to a URl that contains file to download. The attached image shows the dialog I am referring to.
I know this has been asked a million times and I have spent at least 24 hours researching and trying other suggestions posted across the web but with no success. I am hoping the attached image will clarify which Firefox dialog box I am referring too.
I have tried the following solutions
1. Creating IAlerts (Alert element is not found)
2. Searching by trying to find the element by xpath (xpath to cancel was not found)
3. WindowsHandler Method (was not able to figure out the window name)
Any help on this would be greatly appreciated. Thank You in advance!
FireFox Dialog
There are several types of "popups".
Javascript dialogs - These are NOT HTML dialogs but are instead Javascript created dialogs. These consist of alert(), confirm(), and prompt() and can be handled with Alert.
HTML dialogs - These take on various forms depending on how they are formatted. If you right-click on the dialog and see the typical context menu for your browser, then it's an HTML dialog. They are part of the DOM of the current page so you can use Selenium to access this just as you would any other page (e.g., no window handles needed).
Browser window - These are actually another browser window that pops up and may look like a dialog, depending on how it's formatted. It's different than an HTML dialog because it can be moved outside of the current browser page frame. You will need to use window handles to access these windows as you would another tab in the browser. Once you get ahold of the window handle, you can access the HTML of the page like any other page.
Browser dialog - these take on various forms but are akin to System dialogs. They are not made up of HTML so they cannot be accessed by Selenium. Other than using a library to access them, you can interact with them in a limited fashion by sending keys such as <SPACE>, <TAB>, <ENTER>, etc.
What you have pictured is a (4) browser dialog. They it takes on different forms depending on the browser you do the action on. Your best course of action is probably send keys. Sometimes, depending on the browser, you can specify settings to autodownload a file to a specific location so that the dialog doesn't come up. I've never used this so I can't direct you there.
I was able to find and close a download dialog box by checking the amount of open windows after the dialog appears. This solution worked for me.
Find a link to open a dialog and click it:
var link = MyBrowser.Driver.FindElement(OpenQA.Selenium.By.Id("Button"));
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
js.ExecuteScript("arguments[0].click();", link);
Get the new window count after the dialog opens:
var newWindowCount = MyBrowser.Driver.WindowHandles.Count;
Switch to the newly opened dialog and close it:
MyBrowser.Driver.SwitchTo().Window(MyBrowser.Driver.WindowHandles[newWindowCount-1]);
MyBrowser.Driver.Close();

How to use Webkit browser with watiN

i am working on an winform application in which i used watiN. Now when i open my website in default winform browser control, than its design become worst. So i want to use Webkit Browser control in my winform app.
I don't know how to use Webkit Browser in watiN.
I also tried to use GeckoFX for it , but it is also not supporting in watiN.
Can anybody please tell me how can i use other browser controls in watin except Default winform browser control.
I am stucked here
Thanks in Advance

How to prevent Silverlight Webbrowser Control to open links in new windows?

I have a Silverlight 5 application which shows a Dynamics CRM 2013 webpage (list of accounts) in a Silverlight webbrowser control. When the user clicks on one entity record in the list the detail view of that record should open in the same browser. It is opened in a new browser window instead. How can I make the Silverlight webbrowser open it in the same window? In a standard Internet Explorer it is opened in the same browser window.
I found a solution how to achieve that in a .Net webbrowser control. However this is different from the Silverlight webbrowser control I have. Especially the "Document" property and the events "DocumentCompleted" and "NewWindow" are missing.
I use Internet Explorer 11 on a Windows 7 machine to test it. Any hint is highly appreciated.
Cheers,
Arne
Try this:
HtmlPage.Window.Navigate(new Uri("the address here"), "_self");
The key is the second parameter "_self", which means that you want to open the link on the same page. You can also use "_blank" for new tab or "_top" to put it on top of the hierarchy.
Useful links
http://msdn.microsoft.com/en-us/library/cc189809(v=vs.95).aspx
http://www.w3schools.com/jsref/met_win_open.asp
Hope it helps

Access Firefox from C#

Scenario is simple:
If you add a web browser in visual studio it adds IE. If you are logged somewhere with IE it keeps you authenticated like reading cookies or sessions. Web browser component and IE is the same.
So, is there a way to access firefox from c# (like web browser or some way) and lets say load a page and get the html of this page? Or load a page, fill a textbox and click a button, all these via c#?
Selenium is a browser automation framework that will let you perform these tasks using C#. There's a driver for Firefox that works very well.
There is no way of using Firefox from within C# by default. You do have a few options however, if you want to do something with it's rendering engine for example you could use GeckoFX to give yourself a nice C# wrapped GECKO engine.
If it involves testing / automation then you could look into WatiN which supports various browsers or even UI automation.

Categories