1

Using following LeanFT C# script to launch google.com page but I want to pass this request through the proxy as all the external links needs to go through proxy due to corporate policies.

IBrowser OBrowser = BrowserFactory.Launch(BrowserType.InternetExplorer); 

OBrowser.Navigate("Google.com");

What is the best way to set the proxy in LeanFT script?

surya
  • 123
  • 10

1 Answers1

1

This is usually managed by PAC scripts. Isn't your company using one?

Anyway, this is definitelly not a task for LeanFT.

You can either delegate to C# in some sense (I'm sure there are some libs out there that help configure proxy), or rely on browser's capabilities.

For example, in Chrome, you can specify at launch:

chrome --proxy-server="http=foopy:80;ftp=foopy2".

In LeanFT context, when you launch a browser using BrowserFactory.Launch, it's launching a browser with no command line parameters, and in current releases there's no way to specify launch arguments, so you'd have to launch manually using C#'s Process.Start (see How do I start a process from C#? for details)

using System.Diagnostics;
...
Process.Start("process.exe");

And then attach to the process using BrowserFactory.Attach

Adelin
  • 7,809
  • 5
  • 37
  • 65
  • Thanks. Our proxy changes on different environments so I need to be able to control through script. Selenium supports this, I thought there is a similar way to do this in LeanFT. https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp#using-a-proxy – surya Feb 22 '18 at 19:59
  • ROBOT framework does support it . https://stackoverflow.com/questions/26358672/test-an-application-behind-a-proxy-server-using-robot-framework-and-selenium2lib – surya Feb 22 '18 at 20:01
  • Both are Selenium based solution. You have to understand that Selenium doesn’t use the native browser, it rather uses a Webdriver, and besides proxy you have to specify all sorts of things like extensions to apply, whereas LeanFT uses the exact same browser (and configuration) as the OS. That’s why there is this configuration difference – Adelin Feb 23 '18 at 05:50