I want to change the proxy port of my firefox driver while it is runing.
It is not important If i use the proxy settings from firefox itself or a 3rd party plugin like Omega switchy.
the main problem is
I can NOT open and close the browser with new arguments
firefox webdirver can not interact with about:preferences or about:config. otherwise I could change it by navigating to those pages
I if I set a system proxy and set firefox to use the system proxy and change the systemproxy by my application every program starts to use it
A similar question has been asked here but not for c#
Dynamically changing proxy in Firefox with Selenium webdriver
Is there any way to resolve this problem?
thanks in advance for any help
Related
I have a Selenium script that controls a Tor browser. However, I'm unable to use the functionality 'New Tor Circuit for this site' even by sending the Ctrl+Shift+L combination to the browser.
Can someone explain how I can achieve this?
For reference, I'm using C# with the OpenQA Selenium package
The "new circuit" is a Tor Browser behaviour, you can't "launch" it with Selenium, Selenium just acts on the viewport.
But you can anyway launch a terminal command programmatically.
Take a look here
or there: link
For a C# WPF application I'm creating, I would like to open a website in Google Chrome.
Chrome is standalone and totally independent from my application.
I start Chrome like the following:
Process.Start("chrome.exe", "http://www.example.com");
So an independent process is started, which is the Chrome instance that loads the desired web address.
What I would like to do, is running arbitrary javascript code on the loaded webpage. Like if the javascript code would be 'injected'.
I do not control the loaded website.
The purpose is to open a third-party webpage and pre-fill in some form fields so the user doesn't have to do this all time.
Is there any possibility to achieve this?
Yes, I've done this many time using Seleniums's JavaScriptExecutor.
You'll want to launch Chrome using the Selenium Driver instead of launching the Chrome process yourself.
https://www.guru99.com/execute-javascript-selenium-webdriver.html
From their example:
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript(Script,Arguments);
I have a website running locally and I want to test the GA code I have by hitting the website repeatedly (with a delay) using C#'s WebBrowser class. The issue is that the GA code (the event) is sent with $('document').ready() and I cannot for the life of me get WebBrowser to actually load the javascript on the page.
I was able to get this to work by using Chrome or Firefox by using var proc = new Process("firefox.exe", "my-ga-args") and that works, but I'd like to run this in the background while I'm doing other work and even if I modify the process to start minimized it still takes focus away from my main window when it closes and re-opens Firefox (using different GA parameters that I have in a list that its looping through).
So, is there any way to get WebBrowser to actually execute javascript that exists on the webpage and have it hidden from view while running?
I think you're looking for something like Google's Puppeteer or given your C# tag, perhaps the .NET port Puppeteer Sharp.
... library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Puppeteer runs headless by default, but can be configured to run full (non-headless) Chrome or Chromium.
I have been using WatiN for some browser automation and website testing. Recently I received a request to automate some task that needs to check a partner website for existence of some SKU (since they don't have a proper API) and confirm transaction.
I tried using WatiN, but since this runs on a server and on-demand, the server desktop is naturally locked at most times and the IE window does not open and the process is never run.
I am looking for an alternative to WatiN, which is preferably a .net library (not a must, but just makes things easier), does not require a logged in user and being free and open source is always nice.
Anyone have experience with this type of automation?
You can use the Selenium WebDriver coupled with PhantomJS.
Selenium is similar in many ways to WaitN but it supports more browsers. PhantomJS is a headless browser and wrapped in a portable executable you can run from your web server.
Once you've added the NuGet packages, you will be able to instantiate a PhantomJS web driver and control a site without having to launch a full-fledged browser.
var driver = OpenQA.Selenium.PhantomJS.PhantomJSDriver();
We use this on build servers since the build agents are not logged in and won't be able to launch a normal browser process.
If you just need to check some HTML, you can use WebClient to make a request to the site, return the content response as a string and parse it.
I have some tests created using Selenium WebDriver. When I run them using IE without proxy - it works awesome, but when I am trying to turn on the Proxy (Automatically detect settings) Selenium can't identify objects. I am getting error message: "Unable to find element "
Does anyone else meet the same situation?
The problem was at "Automatically detect settings" feature which has socks configuration parameters. Somehow it was blocking some of selenium interactions channel with browser.