is there any possible way to check is in webBrowser1 is any jquery dialog active?
here's how looks the dialog which i want to check
i using c# webBrowser class, this is not in a simple html webpage
Have you tried this -
if($(".ui-dialog").is(":visible"))
{
//dialog is open
}
Use this:
$("#mydialog").dialog( "isOpen" )
Related
I'm currently having an issue after a click on an hyperlink inside a wpf Page.In my RequestNavigate or Click (both have the same behavior in this situation) event I do the usual Process.Start(hyperlink.NavigateURI).The problem is that this event opens the webpage both in the default browser (the behavior I'm looking for) and in my wpf Page object as well which I don't want.I was wondering if there was any workaround for this issue? Thanks in advance.
You need to set e.Handled = true to say you have already handled the hyperlink
See Example using Hyperlink in WPF
The reason your current page also loads with the Url is because you are using a Hyperlink. Try using either a Hyperlink with no Url, a button or a styled Label
I have an HTML page with this script:
<Script>
function Run()
{
alert("The Content Here");
return true;
}
</script>
<button onclick="Run();">I Want It Now</button>
Lets say that I opened this page with firefox or Chrome. And lets say that I clicked on the button "I Want It Now" and the page shows me the alert:
The Content Here
How can I insert the alert content into a string in my VB.NET project? I know that I can use the alert window handle to get the label handle and then extract (grab) the text of the alert, but I don't think that this is the best way to do it. Is there another way to pass (or get) information from the page (not from webbrowser control or by using webClient.DownloadString) into my VB.NET (or C#) project?
i don't this it will easy to use js without the webbrowser control by the way if you changed your mind and want to use a web browser control , you can do it like this :)
WebBrowser1.Document.GetElementById("NAME").InvokeMember("click");
I use WatiN to automate my testing but how could I handle Web Page dialog window? I can connect to it but can't see source code of it.
Use firebug in Firefox to see the Page Elements/ Dilaog Elements
If you want to handle popup dialog use
ConfirmDialogHandler handler = new ConfirmDialogHandler();
using (new UseDialogOnce(browser.DialogWatcher, handler))
{
browser.Link(Find.ByClass("Your class")).ClickNoWait(); //The action that triggers the dialog
handler.WaitUntilExists(60);
handler.OKButton.Click();
}
There are some things that I didn't find how to do using geckofx:
Get the URL of a clicked link.
Display print preview window.
Does this functionality exist in geckofx? If not, what's the best way
to achieve it in a C# project that uses GeckoWebBrowser to display html pages?
Thanks
To get url of clicked link you can use:
void domClicked(object sender, GeckoDomMouseEventArgs e)
{
if(geckoWebBrowser1.StatusText.StartsWith("http"))
{
MessageBox.Show(geckoWebBrowser1.StatusText);//forward status text string somewhere
}
}
To show print dialog box you can use:
geckoWebBrowser1.Navigate("javascript:print()");
OnNaviagted event should give you the link, and look for the print interfaces nsIPrintingPromptService::ShowPrintDialog in Geckofx.
geckoWebBrowser.url
That will give you the url at any point I believe where geckoWebBrowser is the name of the control, however as pointed out you'll be able to get it from the document completed and navigated events using e.url .
For printing, see this forum thread. Make sure to read it all before starting. Essentially you'll have to patch and recompile GeckoFX.
I need to open a new window from code-behind on post-back if a specific radio button is selected.
Is there any way to do this?
Thank you.
You can use RegisterStartupScript to send a window.open script to run once the page has loaded.
However, this will cause the majority of popup blockers to get in your way.
I think this should work ;-)
Add some javascript to your radio button to open a new blank window before you post back. This makes it so popup blockers won't block your popup, since it's opened in response to a users click. See this link for how to do this part.
Then, allow the postback to happen as normal and on page load, register a startup script to tell your already existing window to go to a new url.
String script = "window.open('popupPage.aspx', 'myPopup')";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "someId", script, true);
Note that in javascript, when you call
window.open(url, 'myPopup')
if a window already exists with that name it'll return it instead of creating a new window... So your popup won't get blocked!
You will need to run javascript on postback
Simple sample of RegisterStartupScript:
RegisterStartupScript("id1", "<script type=\"text/javascript\">alert(\"I'm from JavaScript.\");</script>");
New windows can be very sketchy, depending on the content that you need to present you might consider using an in window pop-in if you will. You will avoid pop-up blockers that way. If you can give more details we can give better answers.