Where do I see what firefoxdriver selenium starts while testing? - testing

I have installed firebug for FF. But when i start firefox it always starts some default ff version, i dont' know where selenium finds it.
I already googled alot, tried to use different firefoxbinary:
System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
final File firefoxPath = new File(System.getProperty("webdriver.firefox.bin")) ;
FirefoxBinary firefoxBinary= new FirefoxBinary(firefoxPath);
firefox = new FirefoxDriver(firefoxBinary,null);
I tried to use different ff profile:
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.addExtension(file);
firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.9.1");
Alas, it does not work!
1. I don't know where to change/find webdriver.firefox.bin
2. I have tried changing path as environment variable,still no progress
maybe I m doing something wrong?

By default, Selenium will open a "vanilla" Firefox profile. If you want to have it launch with your profile, you can do that, but you have to select which profile you want to use. I will warn you that you often don't want to have your regular profile used because you'd like a clean, consistent working environment.
But you could certainly:
set up a profile (call it, for instance, selenium-profile using
Firefox's profile manager
run Firefox choosing that profile--from
Windows's Run dialog run "c:\Program Files(x86)\Mozilla
Firefox\firefox.exe" - P" or the equivalent path to FF if you are
32-but.
install Firebug using that profile.
then choose that profile when you launch your tests.
For information about how to do all this, look at this article.
Then, in your code, you can just call that profile. Step 3 in the article linked above shows how to do this.

Firefoxdriver starts a new default profile on each instance and this profile will be created in your temp folder and will be deleted after you quit the driver. There might be some old instances of ff profile which contains older version of firebug in your temp folder which might be not be deleted as webdriver quited unexpectedly.Try clearing your temp. It might help you as it did for me.

Related

Selenium not go to url when open profile firefox [duplicate]

As the documentation states, you can call webdriver.FirefoxProfile() with the optional argument of profile_directory to point to the directory of a specific profile you want the browser to use. I noticed it was taking a long time to run this command, so when I looked into the code, it looked like it was copying the specified profile Problem is, it takes an extremely long time for the profile to copy (something like >30 minutes, didn't have the patience to wait for it to finish.)
I'm using a hybrid of userscripts and selenium to do some automation for me, so to setup a new profile every single time I want to test out my code would be burdensome.
Is the only way to change this behaviour to edit the firefox_profile.py itself (if so, what would be the best way to go about it?)?
As per the current implementation of GeckoDriver with Firefox using the FirefoxProfile() works as follows :
If case of initiating a Browsing Session through a new Firefox Profile as follows :
from selenium import webdriver
myprofile = webdriver.FirefoxProfile()
driver = webdriver.Firefox(firefox_profile=myprofile, executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
A new rust_mozprofile gets created on the run as follows :
1521446301607 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\ATECHM~1\\AppData\\Local\\Temp\\rust_mozprofile.xFayqKkZrOB8"
Of-coarse on a successful closure (i.e. successful invocation of driver.quit()) the temporary rust_mozprofile.xFayqKkZrOB8 gets deleted/destroyed completely.
Again in case of initiating a Browsing Session through an existing Firefox Profile() as follows :
from selenium import webdriver
myprofile = webdriver.FirefoxProfile(r'C:\Users\AtechM_03\AppData\Roaming\Mozilla\Firefox\Profiles\moskcpdq.SeleniumTest')
driver = webdriver.Firefox(firefox_profile=myprofile, executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
Similarly a new rust_mozprofile gets created on the run as follows :
1521447102321 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Users\\ATECHM~1\\AppData\\Local\\Temp\\rust_mozprofile.2oSwrQwQoby9"
Similarly in this case as well on a successful closure (i.e. successful invocation of driver.quit()) the temporary rust_mozprofile.2oSwrQwQoby9 gets deleted/destroyed completely.
So the timespan you are observing is the time needed for a FirefoxProfile() to scoop out a new rust_mozprofile.
Perhaps as per your question timespan for profile to copy (something like >30 minutes) is a pure overhead. So it won't be possible to use a Firefox Profile without making a copy of rust_mozprofile.
Solution
Upgrade Selenium Client to current levels Version 3.11.0.
Upgrade GeckoDriver to current GeckoDriver v0.20.0 level.
Upgrade Firefox version to Firefox Quantum v59.0.1 levels.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Firefox base version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Firefox Quantum.
Execute your #Test.

selnium chromedriver.exe executable needs to be in PATH [dup]

selenium not work, and tried many things
i know this has been ask allllllllot, but i dont know what's going on my computer
1. added enviorment path
2. basically put chromedriver.exe every location in my file
3. correct version (chromedriver and chrome)
4. added executable_path
5. i can opne chromedriver.exe in cmd
driver = webdriver.Chrome(options=chrome_options, executable_path=r'C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe')
all above is not work, i just wanna use selenium,any good idea? except reload system? (win10)
error pic
From the image picture , your chromedriver is clearly in the wrong path. Go to your command prompt , and run
chromedriver.exe
See if you are not able to execute it , it means that the path is incorrect.
Remedy
1) you need to make sure you have install Chrome.
2) Get the latest chrome driver here
3) Set path in your environment
4) In your script , this alone should work
browser = webdriver.Chrome()

Is it Firefox or Geckodriver, which creates "rust_mozprofile" directory

Whenever we invoke Firefox, under '/tmp' directory rust_mozprofile directories are getting created. As Firefox internally calls Geckodriver we are not sure whether Firefox or Geckodriver is creating rust_mozprofile directory.
I do want to know whether Geckodriver or Firefox because, my '/tmp' directory is having less memory.
So the question is I really want to modify the path of creating directories for rust_mozprofile.
I am using below technologies,
Selenium - 3.3.0
Firefox - 52.2.0
Geckodriver - 13
Please give us some suggestion, if there is any.
If you have a closer look at the geckodriver v0.18.0 logs closely you will observe the very first occurrence of rust_mozprofile occurs in the following line:
1504762617094 Marionette CONFIG Matched capabilities: {"browserName":"firefox","browserVersion":"56.0","platformName":"windows_nt","platformVersion":"6.2","pageLoadStrategy":"normal","acceptInsecureCerts":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"specificationLevel":0,"moz:processID":5848,"moz:profile":"C:\\Users\\AtechM_03\\AppData\\Local\\Temp\\rust_mozprofile.OfFuR9ogm33d","moz:accessibilityChecks":false,"moz:headless":false}
This log clearly indicates that marionette is being configured with:
"moz:profile":"C:\\Users\\AtechM_03\\AppData\\Local\\Temp\\rust_mozprofile.OfFuR9ogm33d"
And this configuration is done by the WebDriver instance i.e. the GeckoDriver.
It's the GeckoDriver which internally configures the Marionette which in-turn initiates the Mozilla Firefox Browser.
IMO, this workflow is in practice since we migrated from the Legacy Firefox to Marionette based Firefox. Hence the same must be the case with Geckodriver - 13 as well.
Update:
GeckoDriver as an application/exe file:
You can set the location with the TMPDIR envvar. It's also useful to set both TMP and TEMP for other programs.
A solution is to use driver.quit() this closes all browsers and takes care of the profiles
Another solution is to add a custom profile
fp = webdriver.FirefoxProfile('specify location to profile .default')
driver = webdriver.Firefox(firefox_profile=fp)
I had a similar problem and I solved it by changing the Environment settings in Windows. Meaning that I changed the directory for the TMP and TEMP files, and after a reboot, the rust_mozprofile folder was generated where I wanted it.
This is the source I used: https://www.toolsqa.com/selenium-webdriver/how-to-use-geckodriver/ Specifically the "Set property in Environment Variables:-" section.
Sadly this will effect all Software that saves files to those folders. (In my case that is what I wanted though.) If there is a way to make only the rust_mozprofile folder be created in a specific directory through the program, I would love to learn more.

JMeter with Webdriver Sampler - Browser window not opening

I am running Jmeter with the Webdriver plugin installed on Windows 7. My current test plan contains the Webdriver sampler and Firefox driver config. When I try to run the test plan, nothing happens. There is nothing recorded in the View Results Tree window, and the remaining test indicator in the top right hand corner counts down to 0 without anything happening.
When I deactivate the Webdriver Sampler and Firefox driver config elements, the remaining tests run without a problem.
Is there a bug with this software, or am I missing something? My code is below, if that helps.
var pkg = JavaImporter(org.openqa.selenium)
WDS.sampleResult.sampleStart()
WDS.browser.get('https://test.test.test.test') var username =
WDS.browser.findElement(pkg.By.id('USERNAME')).sendKeys([WDS.args[0]])
var password =
WDS.browser.findElement(pkg.By.id('PASSWORD')).sendKeys([WDS.args[1])
WDS.sampleResult.sampleEnd()
I have installed firefox 26, as this is the recommended supported browser, so it's not that there's no compatible browser.
My main question is this - Why doesn't the browser window open? Why do the other tests in the test plan fail to run when the config elements are active?
In 99% of cases the answer should be in jmeter.log file. In the meantime a couple of recommendations:
add the following line to system.properties file (lives in the /bin folder of your JMeter installation)
webdriver.firefox.bin=/path/to/your/firefox.exe
See https://code.google.com/p/selenium/wiki/FirefoxDriver page for other Firefox-related properties
locate all duplicate http* libraries like httpcore*.jar httpmime.jar etc. and remove the ones with lesser version
restart JMeter to pick the property and the changes up
Check out The WebDriver Sampler: Your Top 10 Questions Answered guide for other tips and tricks
You need to make sure you provided the full path of the Firefox driver in the jp#gc config element.

Firefox wants to update when I am using selenium?

Firefox is up to date on my computer but when I use selenium sometimes it messes up my program by saying that I need to or should update. Eventually this window can stop my program from working..is there any way to stop this?
Thanks.
If this is on a machine you have access to firefox has a setting that allows you to disable checking for updates which is the easiest way.
If you want to enforce this for all test runs, apparently the following should work:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("app.update.auto", false);
profile.setPreference("app.update.enabled", false);
FirefoxDriver browser = new FirefoxDriver(profile);
In addition to the accepted answer:
1.) You can change the two autoupdate settings he mentioned in about:config of your FF profile, if you are reusing the same FF profile each time you run tests
2.) There are additional settings (e.g. outdated plugins can cause FF to update, extension options to autoupdate need to be turned off) which may help: https://support.mozilla.org/en-US/kb/how-stop-firefox-making-automatic-connections
3.) After doing both 1 and 2 above if you still have issues, deleting updater.exe from the Mozilla program folder (C:\Program Files\Mozilla Firefox\ or the x86 location) might do the trick but could also, as deleting a file from the programs folder can do anytime, cause unexpected problems