How to make Google Chrome console persistent?
In Network tab their is a option "preserve logs" how to set this using selenium webdrver.
In case of firefox their is preference "devtools.webconsole.persistlog" If "devtools.webconsole.persistlog" is set to true then it will enable persistent logging(preserve logs). any equivalent preference/way in Chrome.?
Related
My Selenium Java test script runs on Firefox browser.
Recently, it has started failing on applications where 'Enhanced Tracking Protection' is turned on.
https://support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-desktop
How can I disable/turn it off via Selenium Web Driver? Is there any preference or capability through which I can turn it off in the Firefox profile?
I'm using Selenium with PowerShell and I had the same issue.
This solution works for me
[OpenQA.Selenium.Firefox.FirefoxProfileManager]$ProfileManager= [OpenQA.Selenium.Firefox.FirefoxProfileManager]::new()
[OpenQA.Selenium.Firefox.FirefoxProfile]$FirefoxProfile = $ProfileManager.GetProfile($ProfileName)
$FirefoxProfile.SetPreference("pref.privacy.disable_button.tracking_protection_exceptions", $true)
I'm running all my test suites on Jenkins which is deployed on AWS EC2 instance. There is a scenario where when I click on a button, new small window opens up and I'm doing assertion for the text visible inside the small newly opened window. But my tests are failing when I run using Headless mode. But, same scripts works fine when I run scripts locally without opting for headless browser.
The issue here is the scripts are failing because of headless browser since it's unable to capture text inside small window which has opened after click of button.
This class is extending InitiateDriver class which explained. Below class is trying to fetch text which is visible inside the new window which just opened after clicked on SignInWithGSuiteSSOClick() button.
Here is the code:
// click on a button
GSuiteobject.SignInWithGSuiteSSOClick().click();
String winHandleBefore = driver.getWindowHandle();
// Here trying to capture text inside new window opened up basically gmail window to enter email
String signInHeader = GSuiteobject.GsuiteSignInHeader().getText();
Assert.assertEquals(signInHeader, "Sign in");
GSuiteobject.GsuiteEmail().sendKeys("example#gmail.com");
InitiateDriver.java
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--window-size=1920, 1080");
options.addArguments("--disable-gpu");
driver = new ChromeDriver(options);
The same code works in browser mode but not in headless. But the driver will be initialized but it fails only while capturing text. Please help me out I'm stuck here and unable to execute it on Jenkins as a headless browser.
Headless chrome browser's gmail UI will be different from actual gmail UI(latest). Hence it fails when we run headless chrome for automating gmail login since xpaths will differ. We can validate that by taking Screenshot by running on headless and normal browser.
I suggest to take screenshot using both headless and normal browser. To check on xpaths for headless we can try driver.getPageSource() method.
I'm running an automation on mac and on ubunto (using cucumber, selenium web driver, junit)
during the automation I click a link with non http protocol
an "External protocol request" popup appears.
It blocks my test from testing the rest of the webpage.
How can disable this popup for all chrome profiles? even incognito\anonymous chrome?
I have tried to add "" to the /Users/eladb/Library/Application Support/Google/Chrome/Local State file.
protocol_handler":{"excluded_schemes":{.."waze":false,"mailto":false,..}
and also tried:
protocol_handler":{"excluded_schemes":{.."waze":ture,"mailto":false,..}
but even after a restart and running the test, the popup appears.
Create you driver instance with chrome options as follows:
ChromeOptions cChromeOptions = new ChromeOptions();
cChromeOptions.addArguments("--test-type");
WebDriver _driver=new ChromeDriver("path_to_your_Chrom_Driver", cChromeOptions);
I tried the 'Local State' file also not working. Someone pointed out the folder Default/Preferences file. Make your change there and it will work.
I have been using Java Selenium WebDriver along with Appium to perform tests on Mobile environment be it Emulator(Genymotion) or Physical devices (Android). I am using chromedriver, which I am using to perform tests on Web App in Chrome browser. I am looping my cases for multiple sets of data but the application requires a full browser Cookie and all Session data to be deleted before each loop starts.
I tried using driver.Manage().Deleteallcookies(), but it did not work out for me. I read in some threads to try creating a new session of the browser before each loop. So I tried driver.quit() but it ends the chromedriver session and ends the test. I also tried driver.close() but got the same results as driver.quit().
Can any one suggest a way to delete the browser cookies and session data in chrome browser??
My Appium version:1.3.4.1
Chromedriver version:2.3
Device/Emulator i am trying to test on : Nexus5/Samsung Note 3 Android:4.4.4/5.0
You can try using the following to ensure a clear session. Note I never tested that myself. My understanding is that selenium by default create a new session unless you specified something different or load a profile.
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
ChromeDriver driver = new ChromeDriver(capabilities);
I wanna detect if java is enabled in a browser without running any jars.I did this in Chrome and Firefox with the navigator.plugins and it's working great, but in IE its returning always true.Any ideas?Thanx in advance.