I am trying to capture JSESSION ID in #beforeClass
Cookie oldCookie =
driver.get().manage().getCookieNamed("JSESSIONID");
ConsoleLog.info("COOKIE VALUE = " +
oldCookie.getValue());
but the script is failing with
org.openqa.selenium.remote.UnreachableBrowserExcepti>on: Error communicating with the remote browser. It may >have died.
I have updated gson version and the issue is fixed
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
Related
I am unable to click elements with script in IE11. Though the same code is working fine for Chrome.
Have tried with Webdriver click, Actions class, as well as JavascriptExecuter.
Details: Windows 10, IE 11, IEDriver 3.4.0
The browser opens normally, navigates to the url, but the click never happens and the test case also passes.
Attaching code snippets
pom
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-ie-driver</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
</dependency>
JavascriptExecuter Code
((JavascriptExecutor)driver).executeScript("arguments[0].click();", we);
Actions Class
Actions ob = new Actions(driver);
ob.moveToElement(we);
ob.click(we);
Action action = ob.build();
action.perform();
Driver Code
System.setProperty("webdriver.ie.driver" , "IEDriverServer.exe");
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
driver = new InternetExplorerDriver(capabilities);
driver.get(url);
I am getting following error:
Response for preflight has invalid HTTP status code 401
for the code which I am using is:
$httpProvider.defaults.headers.common['Authorization'] = 'Basic auth' + "username" + ":" + "password";
When I am trying to run this code in Chrome it is giving me such error but when I am trying to run the same in Internet Explorer its working fine.
Maven dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
application.properties:
security.user.password=password
security.user.name=username
Please help me out.
Description:
Here below code of simple AppiumDriver initialization which always fails
with error below (independently whether selenium is present in maven dependencies or not)
test:
#Test
public void testSomething() throws MalformedURLException {
AppiumDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), new DesiredCapabilities());
driver.quit();
}
}
https://www.refheap.com/d0ec095c62d8061ac2cef768d
output error:
java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
https://www.refheap.com/b71dbf880e1c997b3a885c13d
POM.XML:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>3.2.0</version>
</dependency>
//Here was 2 cases: with and without selenium dependency
//both was not helpful
Interesting:
If I create simple Selenide\selenium test without appium in the same project where mentioned test is located - all tests are correctly working
What I did:
maven .m2 folder clean up - did not help,
importing\deleting selenium java clients - did not help,
Creating clean project - did not help,
does anyone know what is wrong?
I see that appium java-client already contains a dependency on selenium selenium-java 2.47.1 inside it's pom file (https://github.com/appium/java-client/blob/master/pom.xml).
NoClassDefFoundError might be thrown when there is a conflict between the same classes in a jar.
I would suggest you to delete
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.47.1</version>
</dependency>
from your pom and try to run it. I hope it helps.
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.47.1</version>
</dependency>
use this in your pom.xml
I'm unable to connect to my Solr instance on Tomcat from SolrJ. I've been through the documentation shown at "http://wiki.apache.org/solr/Solrj" , but its pretty outdated - primarily because it has no reference on Solr cores. I'm wondering if somebody could point me to the latest documentation OR advise on how to connect SolrJ with Solr4.0 or ahead - although my instance is running just 1 core for now.
Here's my connection string: "localhost:8080/solr-example/collection1/". Do you know which jars to add along with solrj? Thats where the trouble might be. For examples, the SolrJ wiki references a jar called commons-codec-1.3.jar which is not to be found anywhere, in the solr 4.0 zip file.
Calling Solr from Java with SolrJ
You can specify the Core directly in the URL.
HttpSolrServer server = new HttpSolrServer("http://localhost:8080/solr/my_core");
SolrQuery solrQuery = new SolrQuery();
solrQuery.setQuery(q);
solrQuery.setStart(start);
solrQuery.setRows(rows);
QueryResponse response = server.query(solrQuery);
HttpSolrServer is reusable for more queries.
The communication between the Solr Server and SolrJ happens via HTTP with a custom binary format. Can you Browse the Solr Web Admin at http://localhost:8080/solr? Depending on your installation, you might need to adjust the port (8080 is default on Tomcat, jetty uses 8983).
Also, did you deploy Solr with a generic name or did you include the Version? Than your URL would be http://localhost:8080/solr-4.2.1/my_core
Dependencies
These are the minimum dependencies you need for using SolrJ. Add these to your pom.xml, if you are using maven.
<dependency>
<artifactId>solr-solrj</artifactId>
<groupId>org.apache.solr</groupId>
<version>4.2.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
If you are not using maven, you need the following jars:
solr-solrj-4.2.0
zookeeper-3.4.5
commons-io-2.1
httpclient-4.2.3
httpcore-4.2.2
commons-codec-1.6
httpmime-4.2.3
wstx-asl-3.2.3
slf4j-simple-1.5.6
slf4j-api-1.7.2
commons-logging-1.1.1
There seems to be a problem with Spring Roo, GAE, and GWT.
Here is a simple roo script.
project --topLevelPackage com.my.gae --projectName gaetest --java 6
persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE
entity jpa --class ~.domain.Person
field string --fieldName name
web gwt setup
web gwt all --proxyPackage ~.proxy --requestPackage ~.request
web gwt gae update
logging setup --level DEBUG
roo script <path-to-above-script>
Fix a bug in the pom by adding <scope>runtime</scope> to the datanucleus-core dependency
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.7</version>
<scope>runtime</scope>
</dependency>
3. mvn gae:run
There will be many errors.
[INFO] Checking rule
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/req
uest/ApplicationRequestFactory.java'
[INFO] [ERROR] Line 11: No source code is available for type com.my.gae.request.PersonRequest; did you
forget to inherit a required module?
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/act
ivity/ApplicationDetailsActivities_Roo_Gwt.java'
[INFO] [ERROR] Line 29: No source code is available for type com.my.gae.proxy.PersonProxy; did you for
get to inherit a required module?
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/act
ivity/ApplicationMasterActivities_Roo_Gwt.java'
I am using 1.2.1.RELEASE [rev 6eae723] of Roo.
Is there a workaround or perhaps I have made an error ?
I was getting several errors as well when trying to create GWT application for the Google App Engine using Spring Roo 1.2.1. I created my project using the SpringSource Tool Suite (STS). Took me forever, but I finally got it working by making some changes to my pom.xml.
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>3.0.7</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>3.0.7</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>3.0.7</version>
</dependency>
I also enabled Datanucleus Support (right click on project, Datanucleus -> Add Data Nucleus Support), then enhanced the classes manually (right click on project, Datanucleus -> Run Enhancer Tool). These Datanucleus steps failed without the preceding pom.xml changes.
The application launches fine. However, now I can't get the RequestValidationTool to work.