How to turn off remote debugging to open this site in IE? - selenium

I am automating an application in Microsoft Edge browser on Windows 11 system. How can I remove that from running browser instance. I also checked similar question asked on stackoverflow but didnt get much help to overcome this banner.
Turn off remote debugging to open this site in internet explorer mode. Otherwise, it might not work as expected
Environment Used :
Windows 11
Microsoft Edge : 105.0.1343.42
Selenium : 3.141.59
BaseDriver.Java
else if (browser.equalsIgnoreCase("edge")) {
System.setProperty("webdriver.edge.driver",
FileReaderManager.getInstance().getConfigReader().getDriverPath() + "/msedgedriver.exe");
capabilities = DesiredCapabilities.edge();
// Creating an object of EdgeDriver
driver = new EdgeDriver();
driver.manage().window().maximize();
// Deleting all the cookies
driver.manage().deleteAllCookies();
// Specifiying pageLoadTimeout and Implicit wait
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
POM.XML
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ChromeTest.com</groupId>
<artifactId>ChromeTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- <dependency>
<groupId>com.github.2gis.winium</groupId>
<artifactId>winium-elements-desktop</artifactId>
<version>0.2.0-1</version>
</dependency> -->
<dependency>
<groupId>com.github.2gis.winium</groupId>
<artifactId>winium-webdriver</artifactId>
<version>0.1.0-1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<!-- <dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-beta-4</version>
</dependency> -->
</dependencies>
</project>
Please refer attached screen shot for your reference

From your description, I think you have configured the site in IE mode site list and tried to automate it in IE mode. It's the expected behavior that you see the error message because you're not using the right way to automate IE mode in Edge.
The right way to automate IE mode in Edge is using IE Driver instead of Edge Driver. For the detailed steps, please follow this guide: Use Internet Explorer Driver to automate IE mode in Microsoft Edge.

Related

Appium - Getting a java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy9.proxyClassLookup() at PageFactory

I am getting this exception on running an Appium test. The test fails at PageFactory with the exception below.
My POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0`
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.telepathy.test</groupId>
<artifactId>twitter</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.2.0</version>
</dependency>
</dependencies>
</project>
This was working fine up until yesterday, my machine got restarted and this error started coming.
Already tried with latest version of Appium (7.5.1)
Did mvn clean and refresh, update
Fails here:
PageFactory.initElements(new AppiumFieldDecorator(this.driver), this);
java.lang.RuntimeException: java.lang.NoSuchMethodException:
jdk.proxy2.$Proxy9.proxyClassLookup()
at ​io.appium.java_client.pagefactory.bys.builder.AppiumByBuilder.prepareAnnotationMethods(
ApiumByBuilder.java:84)
Check the version of Java you are using. I downgraded from JDK v16 to v15.0.2 and that fixed the problem.
I also faced same issue but was not getting any solution for it.
Just check you are using AppiumDriver instead of AndroidDriver.
& You are using #FindBy annotation instead of #AndroidFindBy in your page object class.
Also use PageFactory.initElements(driver, this); instead of PageFactory.initElements(new AppiumFieldDecorator(driver), this);
This worked for me. It it works for you kindly acknowledge here.
Thanks
You have to rebuild your project on java version 1.8 (which will be the minimum version), then you will have to insert your jre and jdk for version 15 or less and it should be fixed.
I was getting same error but when I am running locally via eclipse it was working fine but when I am running via command line it was failing then I have added compile version in build i.e. gradle in my case. Similarly you can add in maven also it will solve the problem.
For me the issue got resolved by following below steps--
Check the versions of maven dependencies -
java version - 1.8,
Appium-java-client: 7.6.0,
selenium-java: 3.141.59,
Testng: 7.5
Update JDK compliance level to JavaSE 11 <= JavaSE15 (Click on project > Windows > Preference > click on Java compiler (left panel) > Click on the dropdown to change JavaSE16 to JavaSE11 > Apply & close )
Initialize the Pagefactory as below:
Note: Replace all the AndroidElement occurences to MobileElement like in base class, page & test classes.
If this answer is useful to you, kindly Upvote. :)

Selenium remote driver issue with HtmlUnit driver

[i'm seeing the issue with Selenium remote driver when I'm executing the script with Htmlunit driver.
Note 1:- Same script works without any issue when I'm running with Firefox driver.]
Note 2: My browser had security authentication process for whatever the site i open, Not sure if that have ant role in this.
I have observed the selenium remote driver under maven shows with little different icon in left pane.
I feel its jar file loading issue.
I tried to put the selenium remote driver manually into .m2 repository.
1
Error message:-
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException
at TestPackage.titleNUrlCheckingTest.main(titleNUrlCheckingTest.java:16)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.SessionNotFoundException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
[enter image description here][2]
You need to use latest version, note the change of artifactId from old versions.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.26</version>
</dependency>
which depends on
selenium-api 3.3.1
Update:
Your pom.xml works with simple test case of HtmlUnitDriver, but there is a potential conflict of versions, you should exclude HtmlUnitDriver 2.24 from selenium-java 3.3.1:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.3.1</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
Also, try to remove all selenium dependencies, and have only htmlunit-driver, all needed dependencies are automatically handled by maven.
Please update your POM XML file with latest version of htmlunit dependency
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.32.1</version>
</dependency>
and remove if you have something like
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.52.0</version>
</dependency>
and update project. This should resolve your exception issue.
Reference: https://github.com/SeleniumHQ/selenium/issues/4930

Selenium-Java:Browsermob Proxyy- NoClassDefFoundError

I updated POM.xml with latest selenium-java dependency and Browsermob proxy.
Java Code:
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
driver.quit();
POM.xml looks like,
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-proxy</artifactId>
<version>2.0-beta-8</version>
</dependency>
While I run the automation script, getting the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/interactions/HasInputDevices
The script runs fine , after removing Browsermob proxy dependency. ( But I need Browsermob proxy to capture network data).
Looks like the Browsermob proxy has a dependency selenium-api-2.*, I assume that is outdated and causing this problem.
Any help would be greatly appreciated.
It looks like you're using a very old version of BrowserMob Proxy, which probably isn't compatible with the latest versions of Selenium.You can find the latest version of BMP on its github page.
For example, the current version of BMP is 2.1.2, so you'd want to include this in your pom file:
<dependency>
<groupId>net.lightbody.bmp</groupId>
<!-- note the new artifactId -->
<artifactId>browsermob-core</artifactId>
<version>2.1.2</version>
</dependency>

Need (Selenium webdriver + Junit) Sample test frame work code or the way how to run

I need a Selenium webdriver + Junit Sample test frame work.
where i can run the below things
1) Frame work should read the inputs/testcase id from config file/txt file
2) flexibility to run particular test case only when it fails.
3) Can be automated.
Currently my test cases are large number, if i use Junit TestSuite then more number of classes needs to be maintained, if i use Junit normal test case then i cant automate & cant run particular fail test case
Please help
#Test
public void test() {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com);
Assert.assertTrue(driver.getTitle().equals("Google"));
}
That's it, easist test you can get. I would also recommend Maven for handling your dependencies, in this case your pom.xml would look like
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.41.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

What is the "official" way to use Selenium 2 (Selenium WebDriver) with Maven?

I'm just trying to make the basic Selenium2Example work with Firefox 4 using Maven to get the Selenium jars :
public class Selenium2Example {
public static void main(String[] args) {
// Create a new instance of the Firefox driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new FirefoxDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Cheese!");
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
//Close the browser
driver.quit();
}
}
If I go there : http://code.google.com/p/selenium/wiki/UsingWebDriver, it says I should try a dependency like this :
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium</artifactId>
<version>2.0b3</version>
</dependency>
but the latest jars can be found in no repositories, the last version which works (with all dependencies found) is "2.0a4" (2.0a5 to 2.0a7 and 2.0b1 to 2.0b3 have missing main jars or missing dependencies), and this "2.04" version doesn't have the right classes to make the example work.
If I go there : http://seleniumhq.org/docs/03_webdriver.html#chapter03-reference, it says I should use this dependency :
<dependency>
<groupId>org.seleniumhq.webdriver</groupId>
<artifactId>webdriver-firefox</artifactId>
<version>0.9.7376</version>
</dependency>
It makes the example compile, but this release hasn't been updated since october 2009, and it doesn't run with Firefox 4 (see http://repo1.maven.org/maven2/org/seleniumhq/webdriver/webdriver-firefox/)
If I go there http://seleniumhq.org/download/maven.html, it says I should try something like :
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>...</version>
</dependency>
But the 2.0b3 version doesn't work either (missing dependencies). Here is the error message :
23/05/11 22:09:07 CEST: Build errors for first-webdriver-test; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project first-webdriver-test: Unable to get dependency information for org.apache.httpcomponents:httpcore:jar:4.0.1: Failed to process POM for org.apache.httpcomponents:httpcore:jar:4.0.1: Non-resolvable parent POM org.apache.httpcomponents:httpcomponents-core:4.0.1 for org.apache.httpcomponents:httpcore:4.0.1: Failed to resolve POM for org.apache.httpcomponents:httpcomponents-core:4.0.1 due to Missing:
----------
1) org.apache.httpcomponents:httpcomponents-core:pom:4.0.1
----------
1 required artifact is missing.
for artifact:
org.apache.httpcomponents:httpcomponents-core:pom:4.0.1
from the specified remote repositories:
central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
I don't know the meaning of this error, since I can find the requested pom here : http://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-core/4.0.1/httpcomponents-core-4.0.1.pom
So the only way I can make the example work for now, is manually downloading the 2.0b3 jars.
Does anybody succeed in making it work with Maven ?
Since RC2, you just need:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium</artifactId>
<version>2.0rc2</version>
<type>pom</type>
</dependency>
For me this is working (with Maven 2.2.1):
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium</artifactId>
<version>2.0b3</version>
<type>pom</type>
</dependency>
Notice this line: <type>pom</type>
Also, I had to add the dependency on the junit library to get it to pass some surefire exceptions, but you might not need this.
With RC3 you need:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.0rc3</version>
</dependency>
to include all the jar
For me, this works:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.29.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.29.1</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>