I want to pop a web browser popup window, with a given url, from Silverlight.
When running within the browser I use HtmlPage.Window.Invoke() to run a javascript and its window.open() in the host browser. Works fine.
But when I run out-of-browser (OOB) this technique obviously doesn't work. So, what to do?
Silverlight 4 has this new WebBrowser control for use when running OOB. It works fine, but I have only been able to run it in a child window within the silverlight application boundaries.
Then there is this hyperlink trick. Also works, but it creates a new tab in the current browser-instance. Not exactly what I want either.
Anything I have missed?
(Alternatively; is there a a way to make the hyperlink pop the url in the same browserinstance and tab every time? instead of creating new tabs.)
Bit of a long post this. Sorry about that and thank you for your patience.
The link you posted to creating a derived HyperlinkButton is the only one I know of. Maybe play around with different TargetName values to see which one works like you want? "_blank", "_new", etc... - one of them may be what you want.
The trouble is that different browsers (when set as the default browser) may do different things, so be sure to try this with IE, Firefox, on a Mac, ...
Related
I have successfully loaded my chrome profile with selenium that has pre-installed extensions.
The extension in question is called Private Internet Access, but i have tried others and cannot communicate with them
I am trying to figure out how i can open the extension below and enter username&password and click login button. I have tried finding the elements in by id and class but it doesnt find them. Can someone point me down the right line for this. Thanks
I've not had the ability to try this - however I've done a lot of work with Selenium and I've created my own chrome extension.
That extension popup in the top right actually a different web page. You won't be able to interact with it due to how it's presented, but you can navigate to it.
Try this:
Open up your extension, right click anywhere and select Inspect. This will open up devtools for the popup.
In devtools, go to the console and type document.url. This will give you the URL of that popup page. (you'll also see it at the top of the title bar)
That gibberish-looking bit in the middle doesn't change - it's your chrome extension identifier. From when I created my extension and 18 months worth of updates (including migrating from chrome extension manifest v2 to v3) it has not changed for me. I think you'll be safe to use it.
Go to that URL to make sure it works. In my case it's chrome-extension://ojhcleddagaoaplflbafhpekcciikdop/popup.html
You'll notice you'll lose some of the page styling compared to the popup. When you design the popup you give it fixed dimensions - when you open it as a normal webpage, you lose that and everything gets stretched.
Finally - for your automation - put that chrome-extension:\\ url as the first step in your selenium script and do your sign in. Then, carry on with the rest of your test.
I tried WebBrowser but any solution related to WebBrowser I find uses the exact same codes, WebBrowser.DrawToBitmap
Problem with that is, it gives out inaccurate results depending on URL, to what page actually would look like, sometimes even blank pages.
So I am looking for any alternate solution to WebBrowser if there is any.
It needs to run in background, as in not open any browser on screen, render it in background with all scripts and get an image.
If I understand what you're trying to do, you might be interested in a framework called PhantomJS, which is a WebKit "browser" engine which runs the pages without visually rendering them. It can be used to capture screens.
Now this technique requires JavaScript, but there is something called Selenium WebDriver to help you wrapping that. Users here at SO posted a simple example and this comment looks useful as it contains the list of required Packages.
I'm new to cefsharp and i cant seem to wrap my head around how I'd be able to handle popups in the simplest manner. These are popups such as when the page requests a new tab, or even when a confirm/alert is fired.
Everything is fine and all with the default settings, but I want the popup's title bar to show a predefined text, like for instance my app's name. By default it shows the url which requested the popup and i don't want that. Besides that, everything can remain as it is.
Any idea how i could achieve this?
i want to use different browsers for my webbrowser controls in c#.NET.
for example, if im log into facebook from the webbrowser1, i will not in the webbrowser2
if i cant use ie different for each webbrowser... can i separate cookies for each webbrowser control?
for example, if i navigate using the first controle
webbrowser1.navigate("this is not important");
then submit the login form
webbrowser1.document.getelem..... click
thats will not applicated on the secod control( webbrowser2)
-
i hope you inderstand what i want :)
The WebBrowser control is a wrapper around IE and will always and only use IE. It's never going to use Firefox or Chrome etc. Some browsers apart from IE may allow Automation, but you'll have to check their documentation.
In your two lines of code, both are using the control called webbrowser1, so the Navigate and getelement will always go to the control. If you want to use two browser instances, you need to have 2 controls.
I don't clearly understand what your question is. The two points above are what I can answer.
I haven't looked into it very much but am struggling to find relevant information on the topic. I basically want to create a browser that applies a filter to a webpage by changing colors in a webpage. My guess is that I will have to change the html once loaded or something, would this work? Do I have other options?
PS. I don't just want to make every color darker, I would more like to invert the colors.
Edit:
If any you were wondering, I am talking about the XAML browser component that can be used in a Windows Phone application.
I think the simplest way to do that is to inject some Javascript into your page once it has loaded.
To do that, you need to set the IsScriptEnabled to true on your WebBrowser control and then subscribe to the Navigated event.
When that event occurs you can inject some JS codeby using the WebBrowser.InvokeScript method.
Here is an example of JS code that darken the page : JavaScript: Invert color on all elements of a page
If you are talking about in a PC internet browser, you can find an add-on to execute Javascript automatically, such as Greasemonkey for Firefox. If you are talking about Windows Phone's Internet Explorer, I don't really know what you could do there, as I don't think they allow add-ons.