Load unpacked extension is disabled in developer - java

I am trying to Invoke Chrome through Selenium Webdriver. It was initially working well. For the past 2 days i am getting an error message
I also noticed that the Load Unpacked Extensions is disabled in my browser.
And here is the Java Program I use
System.setProperty("webdriver.chrome.driver","C:\Users\C59122\Desktop\SELENIUM\chromedriver_win32\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
String regur = "https://google.com";
driver.get(regur);
Can someone please help me fix the problem?

Related

Selenium webdriver is looking at wrong path for Chrome.exe

I am trying to launch chrome.exe from selenium webdriver i have chrome installed on my machine and chromedriver path is also given in code but selenium webdriver for java is looking for chrome.exe on wrong path and giving error and not launching browser.
I have tried options class to locate the chrome.exe with the actual path of chrome.exe but not working for me.I have done required imports as well but still no success.
I have tried below selenium webdriver java code
public class News24Test
{
public static void main(String[] args) throws Exception
{
System.setProperty("webdriver.chrome.driver","C://News24SA//ChromeDriver//chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("C://Program Files(x86)//Google//Chrome//Application//chrome.exe"); // Provide absolute executable chrome browser path with name and extension here
WebDriver driver = new ChromeDriver(options);
driver.manage().window().maximize();
driver.get("http://www.news24.com");
}
}
Selenium is looking at below path which is wrong path
C:\Users\orestip\LocalSettings\Application Data\Google\Chrome\Application\chrome.exe
Try setting the options first:
ChromeOptions options = new ChromeOptions();
options.setBinary("C:\\Program Files(x86)\\Google\\Chrome\\Application\\chrome.exe");
System.setProperty("webdriver.chrome.driver","C:\\News24SA\\ChromeDriver\\chromedriver.exe");
WebDriver driver = new ChromeDriver(options);
Make sure the chromedriver version and the chrome browers versions match.
You can either update your chrome browser to match the driver version or you can choose a chromedriver that matches your browser version.
Hi so old question but if anyone else is a bit stumped by this, I'll give my take.
So, you may one day have a working chromedriver and then it suddenly just stops working. What actually happens is Chrome updates behind the scenes and makes it out of date.
What you need to do is update your chromedriver so it matches your actual, normal Chrome installation.

org.openqa.selenium.phantomjs does not exist

I am trying to use PhantomJSDriver with selenium. However, it gives an error.
System.setProperty("phantomjs.binary.path", "C:\\Users\\Caglar\\Desktop\\Tepav CV\\Phantomjs\\bin\\phantomjs.exe");
WebDriver driver = new PhantomJSDriver();
This is the code but it gives error as follows:
package org.openqa.selenium.phantomjs does not exist
cannot find symbol WebDriver driver = new PhantomJSDriver();
I have seen the same examples on stackoverflow. Can you explain why it does not work? Which version of selenium should I use? Is there another way to use headless browser with selenium? I also tried HtmlUnitDriver but I was not able to scroll down so it did not work as well.

How can I send data in text field using Selenium?

I'm having an issue when I'm going to send data in text field. I got an exception.
I'm using Firefox version 54.0b1 (32-bit) and Selenium 3.3.1.
driver.findElement(By.xpath(".//*[#id='email']")).sendKeys("Test");
The exception:
Exception in thread "main" org.openqa.selenium.InvalidArgumentException: Expected [object Undefined] undefined to be a string
you need to download the latest gecko driver for Mozilla Firefox 54.x and Selenium 3.x.
Also provide accurate path as follows:
System.setProperty("webdriver.gecko.driver", "C:\\directory\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http:\\yoururl.com");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.xpath(".//*[#id='email']")).sendKeys("Test");
Hope it will work for you.
This is actually a Firefox issue and issue have been recorded. Go through the below link for more info
https://bugzilla.mozilla.org/show_bug.cgi?id=1357661

Selenium not able to identify the newly opened window in the IE browser

I am not able to identify a newly opened window in my application.
After using driver.get("my app url") when I try to click on any object, I am getting org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window.
I replicated the same issue on flipkart website using the below code :
System.setProperty("webdriver.ie.driver","path to IEDriverServer.exe);
WebDriver driver = new InternetExplorerDriver();
driver.get("https://www.flipkart.com");
Thread.sleep(10000); // just for sample
driver.findElement(By.linkText("24x7 Customer Care")).click();
But when I run it I am getting NoSuchWindowException.
It is working fine in chrome and Firefox browser.
Selenium Version =2.53.0 ,
OS= Windows7
I tried by adding ignoreProtectedMode and IntroduceFlakinessByIgnoringSecurityDomains capabilities as well but even that is working.
Kindly assist.
Use this it works for you
System.setProperty("webdriver.ie.driver", "path to IEdriverServer.exe" );
WebDriver driver =new InternetExplorerDriver();
driver.manage().window().maximize();
driver.get("https://www.flipkart.com");

ChromeDriver - Disable developer mode extensions pop up on Selenium WebDriver automation

I'm having the following issue:
When I'm running my automation tests, I keep getting the following alert "Disable Developer Mode Extension" in Chrome.
Is there a way to remove/disable this?. It is a blocker for me as it is making me fail some tests.
Thanks in advance
Did you try disabling the developer extensions with command line param?
Try with the following Selenium WebDriver java code:
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions");
driver = new ChromeDriver(options);
I cannot disable extensions because I'm developing & testing one.
What I'm doing to dismiss this popup is the following:
I load chrome with my extension using Selenium.
I then immediately create a new window (via the SendKeys(Control-N) method). This predictably brings up the "Disable Developer Mode Extensions" popup after 3 seconds in the new window.
I can't tell programmatically when it pops up (doesn't show in screenshots) so instead I simply wait 4 seconds.
Then I close the tab via driver.Close(); (which also closes this new window). Chrome takes that as "cancel", dismissing the popup, leaving the original window and tab.
I find this necessary because the popup interferes with normal selenium browser interaction, like SendKeys, which I'm using to switch tabs and windows.
As of Chromedriver v2.33, the correct way to avoid this message is to pass load-extension to the excludeSwitches argument of the chromeOptions object. The following Java code should do the trick, although I haven't tested it, as I am running Python:
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Collections.singletonList("load-extension"));
As others have pointed out, the culprit is probably the Chrome Automation Extension, which is loaded automatically by Chromedriver when it launches Chrome.
Chromedriver v2.33 introduced the new switch to prevent the extensions from being loaded:
Updates to excludeSwitches capability that now allows to exclude --load-extension switch.
I suspect that this solution does not require you to disable all extensions. You should still be able to manually load others.
This has been automatically fixed with a combination of ChromeDriver.exe V2.23 + Chrome 53.0.
To understand which chrome version will work with which driver, we can use the following well detailed doc: https://sites.google.com/a/chromium.org/chromedriver/downloads
Enjoy Automated Testing!!
I worked around this issue by using AutoIT.
First, you'll need to create the script.
closechromewarning.au3:
WinWaitActive("[CLASS:Chrome_WidgetWin_1]")
Send("{ESC}")
The script needs to be compiled to a .exe, then place the .exe in the path so it can be run.
Function that closes the warning, using c# syntax:
public void CloseChromeDialog()
{
System.Threading.Thread.Sleep(5000);
Process.Start(#".\closechromewarning.exe");
}
Sleep(4000) did work, but I upped it to Sleep(5000) just to be sure.
Calling CloseChromeDialog():
if(browser == chrome) //pseudo code
CloseChromeDialog();
resolved in chrome 54 and chromedriver 2.25
I too faced this problem. The solution is, if you are using maven then just add:
-Dchrome.switches=--disable-extensions
It will disable all the extensions and you will not face this problem.
I am using selenium Webdriver 2.53 and chrome version 56.0.2924.87 and the chrome driver.exe which I am using is 2.27. with this combination it is working with the
System.setProperty("webdriver.chrome.driver", "./utilities/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions");
DesiredCapabilities caps = new DesiredCapabilities().chrome();
caps.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(caps);
Try to add setProperty above ChromeDriver instance
System.setProperty("webdriver.chrome.driver","C:/[PATH]/chromedriver.exe");
driver = new ChromeDriver(capabilities);
pywinauto works
import pywinauto
window_title = "Disable Developer Mode Extensions"
app = pywinauto.Application().connect(name_re=window_title)
win_ext = app.window(name=window_title)
win_ext.close()
This is because one of your extensions is running in developer mode. Go through your extension list and disable extensions one-by-one until you find the culprit(s).

Categories