Selenium: Change Tor circuit - c#

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

Related

Is it possible to open Chrome process and execute javascript on a website in the Chrome window?

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);

Changing proxy port with selenium while runing in c#

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

Can we capture GET responses via ChromeDriver Selenium?

When i navigate a page, the page makes several GET requests. I wonder that, can I capture individual GET requests by using ChromeDriver Selenium?
C# 4.6.2
Selenium itself can't capture network traffic, but you could use it with this embedded proxy and it should work fine.

Selenium C# test script: Input data does not work if I minimize the browser

A mileage field in our site has validation can't be null. I enter mileage and click on next in my test script:
wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("mileageInput"))).SendKeys("99");
_driver.FindElement(By.XPath("//div[#id='mileage']/div/div/table/tbody/tr/td[3]/a/strong")).Click();
When my Firefox browser has focus, then this code works fine. But if I minimize the browser or move to any other application, my script gives the error "Please enter mileage".
The code is not working with a minimized browser. How can I solve this?
I made the same experience like #IModulo5, that Selenium needs the Browsers to not be minimized , furthermore I made the experience that Internet Explorer needs the focus too. So minimizing the browser won't work. But you can use Selenium RemoteDriver and execute the browsers on a different machine. That way you wouldn't see the browser.
If you don't need the FF Browser, you could also use the PhantomJS Driver.

Selenium WebDriver IE6 with enabled proxy issue

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.

Categories

Resources