Does proxy-auto-detect work in CefSharp.Wpf? - proxy

I am trying too get CefSharp to auto resolve proxy settings. Chrome can do it. You can even change the proxy setting while Chrome is running and Chrome will react on it.
I am using proxy-auto-detect. But it's not working
Can anyone confirm that its works in CefSharp v.63.0.3
settings.CefCommandLineArgs.Add("proxy-auto-detect", "1");
The only way I can get proxy settings to work is if I set it my self
settings.CefCommandLineArgs.Add("proxy-pac-url", autoConfigUrl);
settings.CefCommandLineArgs.Add("proxy-server", proxy.ProxyAddress.Replace(' ', ';'));
Link to proxy settings for Cef

Related

The Web MIDI API is not supported by your browser - Google Chrome on Mac - when code is run locally

Folks,
I am trying work on a simple Web MIDI app.
I already looked up and found out that Google Chrome is the only browser that supports this. So, I installed this but I still get this.
WebMidi could not be enabled Error: The Web MIDI API is not supported
by your browser.
at WebMidi.enable (webmidi.min.js:30)
at script.js:430 (anonymous) # script.js:432 WebMidi.enable # webmidi.min.js:30 (anonymous) # script.js:430
Promise.then (async) (anonymous) # script.js:154
Mac - 10.15.2
Chrome - 79.0.3945.117
According to this link - https://www.midi.org/17-the-mma/99-web-midi , Chrome definitely has the support.
Important Note - If I were run the code directly on codepen, it works just fine. So the browser is working. But when I try to run locally, I get the error.
https://codepen.io/teropa/pen/JLjXGK
WebMidi.enable(err => {
if (err) {
console.error('WebMidi could not be enabled', err);
return;
}
What am I missing here? is this a chrome issue or Mac issue or some permission issue. Or, is there is something specific I need to make the MIDI code run locally?
I am using this server, https://www.npmjs.com/package/http-server, to run the code locally.
(I have looked at other questions but did not find anything that relates to Chrome on Mac)
I've used web-midi with Chromium and Opera on 10.12.6, so I wouldn't say that Chrome is the only browser that has web-midi.
With Opera I think I had to enable experimental features:
chrome://flags/#enable-experimental-web-platform-features
Maybe see if Chrome needs that too?
Or maybe it's just a side-effect of all the lock-down in 10.15?
if serving dev site from 0.0.0.0 you won't get any MIDI in browser, but when loading from 127.0.0.1 it should work ( as commented by user Alex above )

Getting proxy settings from electron

When i set proxy settings in the system my Electron application gets it automatically for common requests (axios package), but not for websockets (socket.io-client package). If i provide proxy settings manually then websockets starts to work too, but i want to try to avoid manual configuration, because it may be tricky to the real app's users. So i'm looking any way to get proxy settings from electron and transfer them to the websockets.
I have tried to use login event for my browserWindow in the both main and renderer process, but it doesn't trigger at all. Is there any way to get proxy settings that electron uses?
I've found the solution. It's possible to take proxy-settings inside the main process.
mainWindow = new BrowserWindow({})
const ses = mainWindow.webContents.session;
ses.resolveProxy('url_you_need_to_achieve', (proxy) => {
// do whatever you want with proxy string, that contains proxy-setting
});

Ruby gem watir changing Firefox proxy settings without being asked to

For whatever reason, watir changes my Firefox browser settings without my instruction to do this.
If I open Firefox manually (at the office), it normally is set to 'No Proxy' and works just fine.
However, if watir launches a new FF instance, it is set to 'Manual Proxy', and a a browser error states that it's trying to use a proxy server which is refusing connection.
We have no proxy server at work.
How do I get watir to launch a Firefox window with No Proxy? I've searched the web and have not found a single example of this.
(BTW, the FF settings from a watir-launched session are independent of normal FF settings; in other words, manually changing FF settings doesn't correct the problem).
Based on the information here, there are 5 different proxy configurations for Firefox:
0
Direct connection, no proxy. (Default in Windows and Mac previous to 1.9.2.4 /Firefox 3.6.4)
[edit]
1
Manual proxy configuration.
[edit]
2
Proxy auto-configuration (PAC).
[edit]
4
Auto-detect proxy settings.
[edit]
5
Use system proxy settings. (Default in Linux; default for all platforms, starting in 1.9.2.4 /Firefox 3.6.4)
It looks like "0" is the one you need. We set that as described on the Watir-Webdriver help page for Firefox:
profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.proxy.type"] = 0
browser = Watir::Browser.new :firefox, :profile => profile
All of the profile["lorem ipsum"] type options are listed in the about:config menu URL in Firefox, and are accessed/changed in a similar fashion.

selenium rc turn off proxy firefox

My issue is caused by incorrect 'proxy' settings in Firefox so I want to disable the proxy in the profile that Selenium uses for my tests.
Currently my profile looks for the local proxy settings file by default:
file:///C:/Users/%username%/AppData/Local/Temp/customProfileDir536e1d9817834e4e838cad55697fc909/proxy.pac
That file contains these 3 lines:
function FindProxyForURL(url, host) {
return 'PROXY localhost:4444; DIRECT';
}
If during the tests I open the settings and set 'no proxy', the app starts working fine. How can I make the tests always launch with the 'no proxy' setting?
I tried to use the -avoidProxy flag when running the Selenium server but that hasn't helped. I also tried using a separate profile for tests but Selenium overrides its settings as well.
Create a new firefox browser profile & set the preferences in it as per your requirement.
Start selenium server with this profile using the switch -firefoxProfileTemplate <path_to_firefox>

Selenium server not starting for custom firefox profile

I'm trying to start the selenium server by passing custom firefox profile to the DefaultSelenium constructor. It opens the browser with specified URL.
DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*custom \"C:/Program Files/Mozilla Firefox/firefox.exe\"",ReadConFile.readcoFile("serverName"));
selenium.start();
the log is
16:39:19.246 INFO - Allocated session 4eb63d37a4ba4d2fb4e351f8f59e3ea6 for https://<myURL>, launching...
then it stays like that and server doesn't start.
however, this works fine if I don't use custom profile.
DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*chrome",ReadConFile.readcoFile("serverName"));
selenium.start();
I need the launch custom profile as I've saved some site certificates necessary for https. Also, I'm executing this from eclipse.
I think my server isn't configured to launch custom profile. Please help me with this.
The start command is not really starting your selenium server per se, it's connecting your selenium object to an already running server with the browser of your choice.
To actually start the selenium [Jetty Web] server that sends / receives commands to your application under test via your specified browser, use a batch file and the switch rs79 is referring to. The contents of your batch file should include his line:
java -jar selenium-server-standalone-2.0a5.jar -firefoxProfileTemplate C:\custom-firefox-profile
Now you have a true selenium server running on your dev machine (localhost) with the default "4444" port. This will specify that any Firefox browser testing will use this profile.
Now your DefaultSelenium constructor, assignment, and other calls can look like this:
DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*firefox","http://www.server.com");
selenium.start()
selenium.open("myApp/")
Firefox will start using the custom profile specified in the batch file that starts the Selenium server, with your desired base URL, and then navigate into your desired application [URL]. If you are beginning your test from "http://www.server.com/" and not "http://www.server.com/myApp", you can omit the last open line.
When you invoke the Selenium RC server, specify the path using the additional -firefoxProfileTemplate clause.
For example -
java -jar selenium-server-standalone-2.0a5.jar -firefoxProfileTemplate C:\custom-firefox-profile
This will enable you to use all the bindings you have saved within the custom profile.
If you want to have Fifefox profile as default in your test:
a) Download latest selenium-server: http://selenium-release.storage.googleapis.com/index.html
b) Download latest Firefox
c) Create FF profile (best in your custom directory) - in my case named "atf" https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles
Default directory where profiles are saved:
C:\Users\johndoe\AppData\Roaming\Mozilla\Firefox\Profiles
d) In my case I use FF 36 and selenium-server-standalone-2.45.0.jar
Run selenium server:
java -jar C:\driver\selenium-server-standalone-2.45.0.jar -Dwebdriver.firefox.profile=atf
Then refer to it in your code:
driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities=DesiredCapabilities.FIREFOX)
If you want to refer to particular profile in your code (here I use default generated folder for profile named "myProfile"):
profile_path = C:/Users/johndoe/AppData/Roaming/Mozilla/Firefox/Profiles/2zvl3dxx.myProfile"
fp = webdriver.FirefoxProfile(profile_path)
driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities=DesiredCapabilities.FIREFOX,
browser_profile=myProfile)
You can add certificates to custom profile
a) Run browser with custom profile
b) Add certificate
c) Remember to tick option in Firefox Preferences/Advanced/Certificates
Select one automatically
to avoid asking for accepting certificate every time as you access tested page
d) Restart browser
e) Navigate to page what will be tested and accept User Identification Request
f) Close Firefox and enjoy custom profile with certificates available from selenium server :)
You can also start the Selenium server in java see here.

Resources