I have IE run on my system , I would like to send it an url.
I would like to know how should I find the running IE proccess and how should I send it the Url
I will need to send the Url to the Running IE process
You can just do this:
System.Diagnostics.Process.Start(url);
It will open it up with the default browser.
Documentation.
Related
So just like uTorrent gets magnet links and opens them,
How can I setup my WinForm app to get a URL from Default Browser (in this case my default is Chrome) and open that URL in EO.WebBrowser within my app?
I don't have any code for this yet, as I don't know where to start.
Is this something that would be assigned as a Registry Key?
I know there are Registry keys for uTorrent to handle Magnet links in HKEY_CLASSES_ROOT\Magnet\shell\open\command.
What I have is WhatsApp Web open in EO.WebBrowser, and when I click on a URL starting with https://web.whatsapp.com or https://api.whatsapp.com it would open that link. The thing is the link should be changed to web.whatsapp.com, instead of api.whatsapp.com
This is an odd one I need some help with. We have an automation project with a windows auth box. We were passing in the user/pass in the url string but we started to notice some issues. I wanted to setup AutoIT and see if this fixed the issue we were seeing but the url we go to is an internal ip:port. When I goto the url ex. 123.34.56.78:1111 the browser (chrome) opens but then fails with:
OpenQA.Selenium.WebDriverException: 'The HTTP request to the remote WebDriver server for URL http://localhost:7233/session/be85ee0483da9772b136488bed19c43b/url timed out after 180 seconds.'
It appears that webdriver is waiting for something to complete and I can't get to the next step.
I have tried the below but each one loads the page and then throws the error.
_webDriver.Navigate().GoToUrl(url);
_webDriver.Url = url;
Any ideas?
We have an internal ASp.NET MVC application which receives requests from an external system.The request looks something like this:
http://test.com/abc/showinfo/12345678990
Controller Action
[Route]
public ActionResult Showinfo(string somenumber)
{
if (somenumber.Contains("1234"))
// Launch Chrome Browser
else
// Launch IE Browser
}
I tried with Process.Start(url ), its works fine in my localbox but fails in Dev server.
Is it possible to Launch a browser in end user system? if yes then please let me know the steps.
Is it possible to Launch a browser in end user system?
Yes.
You can use PsExec to do it. But do note that if you impersonate credentials, it will send the password over the network in plain text.
psexec \\marklap c:\thebrowserpath\thebrowser.exe
References:
http://windowsitpro.com/powershell/common-ways-run-programs-remote-computers
http://ss64.com/nt/psexec.html
System.Diagnostics.Process.Start("iexplore.exe", "http://google.com");
You can replace http://google.com with your custom url
I don't know if it is possible with your solution, but I think it would be more sensible to open a browser on the client as reaction to an answer from your service, i.e. the following workflow
The client sends a request to your server
Your server processes the request and constructs and answer. This answer contains the URL and the desired browser
The server sends the answer back to the client
The client receives the answer and checks for the URL and the desired browser
The client starts the desired browser with the URL
Depending on the client system (is it some sort of custom application/service?) opening the a new browser could be quite simple (Process.Start() or similar). If the whole thing runs in a browser, it could also be just opening a new tab (if it's the same browser). Opening an alternative browser may be tricky, but could be possible for instance in Chrome with Native Messaging (https://developer.chrome.com/extensions/nativeMessaging)
I have a jQuery script in which I want to download a file which is located on some server after the user clicks on the link. On IE11 this works alright, as I simply make a call to:
window.open('file:///MyServer0001/SomeFolder/Tmp/ToiletFlush.log'
I know that for security reasons, Chrome doesn't allow to use the protocol file:/// . It is interesting because if I write myself this URL on the address bar he will show the file, however if I make a call for window.open() he just opens me a new empty window. Also, removing the file:/// , doesn't do anything on Chrome, it says that the page is not available
So right now I don't know how to make this work on chromium. I thought I could make a workaround by calling the controller function through a POST/GET , return a FileResult and download the file. This definitely works but I would like to know a simple way to do this directly only using jQuery/JavaScript.
Any Idea?
Try ASP.NET MVC FileResult:
View:
Download File
In Home Controller:
public FileResult GetFile()
{
//Read file content into variable.
string content=File.ReadAllText("filepath");
byte[] byteArray = Encoding.ASCII.GetBytes(content);
return File(byteArray, System.Net.Mime.MediaTypeNames.Text.Plain, "ToiletFlush.log");
}
Try this,
On Windows:
1. Find the local URL of your Chrome Install
2. From the Command Line launch Chrome w/ '–allow-file-access-from-files' prepended to it:
–allow-file-access-from-files C://...
On OSX, just type this in Terminal:
open /Applications/Google\ Chrome.app --args --allow-file-access-from-files
Using Google Chrome Canary is also possible:
open /Applications/Google\ Chrome\ Canary.app --args --allow-file-access-from-files
Or... You'll need to run your application on a local server.
this works on dev as usual when I put it on UAT the code does something different. A PDF is saved on the server, the class then opens it up using the url of that file.
The URL works fine if I paste it into a browser, but doesn't work from the code.
Here's my code:
Process.Start(openPath);
openPath will look like: "http://www.cbm360.net/test/temp/CBM360Report_1093750.pdf"
The file is there on the server, but it just won't open in the code.
The code is inside a web method called using AJAX, if that makes any difference, I'm not sure.
Does anyone have any suggestions as to why this isn't working?
The Exception is:
System.ComponentModel.Win32Exception: The system cannot find the file specified
Thanks!
Instead of pasting the URL into a browser (I assume this is on the server), try it directly from the command line on the server. Does it work now? Process.Start is not the same as navigating to a URL in the browser, it is more akin to running the URL from the command line. I am not sure what you are trying to achieve. Normally we would use a web request to get a pdf.