How to open silverlight childwindow as separate browser - silverlight-4.0

when click on any button it should show the silverlight childwindow as a popup but insteadof modal popup i want to open child window as separate window/browser with the url

Please try this
HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
HtmlPage.PopupWindow(new Uri(http://localhost:51327/MyprintPage.aspx), "_newWindow", options);

Related

open a link in new tab in selenium

I am trying to open a link in new tab.
Trial1
Actions action = new Actions(Driver).KeyDown(Keys.Control).KeyDown(Keys.Shift).Click(FindElement(xxx).KeyUp(Keys.Control).KeyUp(Keys.Shift);
action.Build().Perform();
This code opens the link in new tab at the same time opens another blank window
Trial2 - right click the link and choose the first option "open link new tab"
action.ContextClick(FindElement(xxx).SendKeys(Keys.ArrowDown).SendKeys(Keys.Enter).Build().Perform();
This opens the link in new window instead of new tab
So what you need to do is first open a new tab using JS executor:
((JavascriptExecutor)driver).executeScript("window.open()");
or
((JavascriptExecutor)driver).executeScript("window.open('the new link here', '_blank')");
If you did not use the secon method continue with the following: switch to the new window and navigate to the link
driver.switchTo().window(here the window handle);
driver.get("here is the link");

Selenium Webdriver - Accessing 2nd Child window(Popup)

I am automating an application in IE where if user clicks a link on the main window , a child window popups. User further clicks another link from the child window where a 2nd child window popsup. Please find the screenshot of the same application screenshot
Problem is that the 3rd popup window is behind the 2nd popup window. with the following code i am able to get the title for the 3rd popup window, but cannot able to work (Like click on any link etc) over there.
Please find below the code which i have used to navigate to 3rd window from the 2nd.
`String Mw1 = driver.getWindowHandle();
//User clicks a radio button on 2nd window
driver.findElement(By.id("CallType-0")).click();
//User click a submit button and after this the 3rd window popsup
driver.findElement(By.id("cmdLogCall")).click();
Set<String> r1=driver.getWindowHandles();
Iterator<String> i2 =r1.iterator();
while (i2.hasNext())
{
String childwindow2 = i2.next();
if(!Mw1.equalsIgnoreCase(childwindow2))
{
driver.switchTo().window(childwindow2);
String z = driver.getTitle();
System.out.println(z);
driver.findElement(By.id("overridelink")).click();
}
}`
Kindly let me know how can i access the 3rd window.Thanks
Use the following code to switch onto the required window
ArrayList<String> allWindows = new ArrayList<String> (driver.getWindowHandles());
driver.switchTo().window(allWindows.get(2));
System.out.println(driver.getTitle());
driver.switchTo().defaultContent();

How to close pop up window, when there is no XPath for close button?

When I clicked on a some link, the popup window is opened on new browser.
I want to close that pop up window, but I am unable to find out the locator.
How to close window, when it is opened as popup in Selenium?
Use this this,it worked for me
// Before new window
String currentWindow=driver.getWindowHandle();
//After window new open
Set<String> handles=driver.getWindowHandles();
//to make set having only one single/current window value
handles.remove(currentWindow);
String[] handlesArray = handles.toArray(new String[handles.size()]);
driver.switchTo().window(handlesArray[0]).close();

how to get (ScriptObject)HtmlPage.Window.GetProperty("Xrm") in silverlight which was embedded in html/javascript showModalDialog

Hi In CRM2011 I created custom button in form. On click of that button it opens javascript modal dialog. This modal dialog calls html where silverlight app is embedded. So my question i s how can I get following information. If silverlight app is in form we may easily get following values but my silver light app opens in modal dialog.
var xrmProperty = (ScriptObject)HtmlPage.Window.GetProperty("Xrm");
You want to talk to the opener. For example, in JavaScript you'd call:
window.opener.Xrm.Page.getAttribute('cei_name').getValue()
to get the value of the "cei_name" attribute on the form.
Try Following code
dynamic xrmnew = (ScriptObject)HtmlPage.Window.GetProperty("Xrm");
if (xrmnew == null)
{
HtmlWindow parentWindow = HtmlPage.Window.GetProperty("parent") as HtmlWindow;
xrmnew = (ScriptObject)parentWindow.GetProperty("Xrm");
}
Guid Id = new Guid(xrmnew.Page.data.entity.getId());

stop colorbox popup closing when clicking anywhere outside the popup

We have a colorbox modal popup which we don't want to close unless the user clicks the "X" at the top right of the popup. Currently, it is closing if you click anywhere outside the popup area.
Many thanks!
Paul
Colorbox has options to modify that functionality. Just add this to your colorbox instantiation:
$("#selector").colorbox({
//your other colorbox options
//...
escKey: false,
overlayClose: false
});