Questions tagged [java]

Questions about testing applications written in Java or test automation written in Java, a popular programming language and runtime environment which allows Java programs to run unchanged on most hardware and software platforms.

Filter by
Sorted by
Tagged with
0
votes
0answers
18 views

Want to click on one of the element from drop down and get selection text for comparison

There is a scenario in which I have to add a user(admin adds a user) from one function of the application and go to other feature and confirm user name is present in the dropdown list. So here the ...
-1
votes
1answer
17 views

Unit Testing and Integration Testing with Robot and Cucumber

I understand that both frameworks are great for acceptance testing but how hard or more complex is writing lower level tests such as integration tests or unit tests using the mentioned frameworks when ...
0
votes
1answer
19 views

Cannot Instantiate Class error Selenium Testng Maven

package com.qa.easy.testbase; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import org.openqa....
0
votes
0answers
10 views

Is it possible to use methods in java library or a java project snapshot in a protractor project?

If I create database testing project using java and export to a snapshot(as a jar), can I use it in a protractor project? Hoping to use in protractor project, protractor,jasmine framework along ...
0
votes
1answer
24 views

run tests in a sequence given a dataProvider object

I'm implementing selenium tests. In the scenario, there are same tests in different pages. So I tried to use 'DataProvider'. It works, but I think there could be a better way. I need to run 'mostView'...
-1
votes
0answers
40 views

Testing Frameworks Confusion: Cucumber.io and Robot Frameworks

I am researching a few testing frameworks for testing non-web projects, mostly Java and C++ projects (and perhaps some Python projects). I have gotten somewhat confused about Cucumber.io and Robot ...
0
votes
2answers
41 views

How do I click on an element available in a specific row where dynamic row is added?

In the below pic, I need to click on the icon in a row which is newly added and column1 value is stored as global variables. Have used the below code, unable to find a solution. WebElement ...
-2
votes
0answers
18 views

WebDriver cannot resolved and chrome driver cannot be resolved to a type

This type of error occurred when writing the Testing program. WebDriver cannot be resolved and chrome driver cannot be resolved to a type. Can anyone help me with this?
1
vote
1answer
49 views

How to get the href value from the xpath?

Below is my element location, i need to find the id from this link. <a href="bnf_view.aspx?QBnfId=BGOOE00003" class="case-hdr" xpath="1">Dean Ambrose</a> Expecting this output-BGOOE00003 ...
1
vote
3answers
46 views

Selenium WebDriver Java: not able to select a value from a drop-down list

I'm trying to select an option from a drop-down list, and I'm not able using the common methods of the Select class. I also tried the selectByVisibleName and selectByValue and same result. Select ...
0
votes
0answers
41 views

Cannot instantiate class tests.LoginPageTest

package tests; import java.net.MalformedURLException; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.testng.annotations.AfterTest; import org.testng....
-1
votes
1answer
40 views

What should be Assert for below code, tried for assertTrue,assertFalse,assertNull and assertNotNull

I have written below code to verify web table data headers and value of rows and columns but when I am adding different assertion for it, its not working and throwing compilation error. Can any one ...
-1
votes
1answer
33 views

Getting Null pointer exception

I am new to Cucumber and I am trying a basic cucumber test. I am getting the below error while running the test. java.lang.NullPointerException at stepDefinitions.Test_steps....
0
votes
1answer
26 views

Compilation error when iterating through While loop, compilation error at line no. 10, start of While loop

I am getting compilation error when trying to store list size value into an int. public class HandleWebTable { private static WebDriver driver; public HandleWebTable(){ super(); } public ...
0
votes
1answer
21 views

Not able to inspect one of the overlay which disappears in fraction of sec before page loads completely

Once i reset the password through selenium script the confirmation overlay page just remains for 2 sec which i`s not captured by selenium to inspect. Please suggest me how to capture/ignore that ...
0
votes
0answers
12 views

Unable to set proxy with BrowserMobProxy while modifying http header request in Selenium with Java

I am able to modify http request header using BrowserMobProxy, the same way explained https://sqa.stackexchange.com/a/37318/9043 But, the problem I am having at the moment is, that I am executing my ...
0
votes
0answers
20 views

Unable to install apk & launch the application in Appium

Appium Server Log: [ADB] Getting package info for 'io.appium.unlock' [ADB] Running 'C:\Users\ab.chauhan\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s 93e6ecca0903 shell dumpsys ...
0
votes
1answer
37 views

How to handle multiple tests in same webdriver instance without closing and opening browser again?

Below is my testscript, have called other class methods to it. I would like to divide the testcases to different tests. Now running all in one that would increase my count again more. @Listeners(...
0
votes
0answers
37 views

Missing a JAR when integrating Google spell checker API into Selenium

I am trying to integrate Google spell checker API in my Selenium code but I am missing some JAR files can anyone help me? Here is my code: Configuration config = new Configuration(); config.setProxy(...
0
votes
1answer
25 views

Waiting for a scroll to be over

I have this function who scroll an element into view and then click on it: private void iClickOnElement(WebElement element){ WebDriverWait wait = new WebDriverWait(driver, 10); ...
0
votes
2answers
30 views

Code to update excel rows, is working in eclipse but not working in JSR223 PreProcessor/Sampler. No error is appearing and file is not updating

import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Iterator; import java.util.Date;...
0
votes
0answers
19 views

Web driver get Item From Local Storage

Here my code: I am getting null exception String sItem = getItemFromLocalStorage("value"); System.out.println(sItem); } public static String getItemFromLocalStorage(String key) ...
0
votes
1answer
23 views

I want to write java code in Jmeter to copy current date in a variable and use this variable in next request. Where should i write?

This is my code: package dateTime; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format....
0
votes
1answer
60 views

if statement throws an exception “org.openqa.selenium.NoSuchElementException” [duplicate]

There is a requirement to check the link "Show All" on page. If It is displayed on page click on that link to expand all the sites on page, then search and click on "Edit Site" button that is starting ...
0
votes
1answer
34 views

Null PointerException on TESTNG ,pagefactory

LoginPage.Java package TestCases; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.PageFactory; import org.testng.annotations.Test; import ObjectRepository....
3
votes
3answers
151 views

How to abstract data classes to be more object oriented?

I have run into problems keeping my tests as object-oriented as possible. I have had to rewrite large portions of my code multiple times now, and I feel that there is a better approach to what I'm ...
0
votes
2answers
51 views

Store values from table for use in later tests

Below is my HTML code. I need to be able to save the names in the table rows (Saurav P, Ranjit M) to use in later tests. <table cellspacing="0" cellpadding="0" summary="Case managers who sign ...
-1
votes
2answers
55 views

Not able to click Logout Button eventhough able to identify the element in selenium webdriver

Environment : IE11 Webdriver/Selenium version : 3.141.59 Language : java Selenium code: driver.findElementByXPath("//span[contains(text(),'Logout')]").click();** HTML code : <span class="v-...
-1
votes
2answers
56 views

How Do I iterate through all the search results in Selenium returned by google search

My test steps are- a) go to google.com b) in the search box start typing a keyword example "IBM" c) google displays all the matching results d) Get the count of matching results in a List of strings....
0
votes
0answers
41 views

Selenium Webdriver - Toggle switch click is not working

I suppose to test toggle switch element to on and off, but while sending click to the element I am getting Clickable element not found error. I have corrected my code with chain action and JavaScript ...
0
votes
2answers
51 views

Test cases stop execution for next test cases after using soft assertion

I have used soft assertion in my test cases, but it stops the execution of all the next test cases. what I know if we are adding soft assertion then particular test case should fail and it should jump ...
0
votes
1answer
34 views

How to run my selenium runnable jar in a different machine without driver files

I am trying to export my project as a runnable jar and run it without driver.exe files being present. I tried incorporating them with below code to make it independent but still unable to run the jar ...
0
votes
1answer
34 views

what does the JavascriptExecutor declaration actually means [closed]

I am trying to understand the meaning of the following declaration: JavascriptExecutor js = (JavascriptExecutor) driver; I know that the left side means to create an identifier js with type as ...
1
vote
2answers
38 views

Creating a common import statement for commonly used imports

import java.util.Properties; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; I have a page object model and each page object requires these ...
0
votes
2answers
65 views

assertequals() returns true but make my test case failed

I have added assertion(Assert.assertEquals(condition,"expected","message")), it returns true then also it gives an error and make my testcase failed, with Assertion error and message? Can any one help ...
1
vote
1answer
61 views

Cucumber sending string list as parameter

I am using cucumber 4.3.0 and I would like to send an ArrayList of String in one of my sentences. It would give something like that: Given I am on page <page> When I do stuff Then keywords "...
1
vote
1answer
48 views

Can I create an executable TestNG Selenium jar with my tests using maven

##### My POM file pom.xml http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 company.myproj myproj 0.0.1 jar <properties> <project.build.sourceEncoding>UTF-8</project....
0
votes
2answers
44 views

I have added Assertion in my tc and make the login tc failed but I am not getting any output on console provided in assertion

I have added Assertion(Assert.asserttrue(true,"login failed")) in my every tc and conditions are according to that but when login tc failed I am not getting any output on console provided in ...
-1
votes
1answer
49 views

Why tests fail when run in eclipse after creating through selenium IDE?

I have created many tests using Selenium IDE and exported into java files in order to run in eclipse. All tests work properly in Selenium IDE but when I run in eclipse(java file) it creates following ...
0
votes
1answer
44 views

Unable to execute single tc, login then run other application features, right now its running as a suite

I have to execute my test cases as a single as well as a suite, right now its running as a suite but not as a single test case in selenium webdriver: Below is my test which are calling methods present ...
0
votes
2answers
49 views

How to write an xpath for a specific text from a whole attribute?

So the problem statement is: I need to store a specific number(marked in RED) from the attribute & for that I want to point to that number in an xPath. Is that possible?
0
votes
1answer
45 views

Handling the case when users get different main pages based on usertype after login

It's more like a theoretical question and I am seeking the best practice here. Given an application where you have different user types, newly registered users get a new UI while old users are ...
0
votes
0answers
30 views

JUnit 5 integration tests for WSL Ubuntu 18.04

Context In order to write integration tests that verify whether running a compiled project.jar file yields the desired results, I thought of doing: Execute a J-unit test that substitutes certain ...
0
votes
0answers
26 views

Code is not being executed once being tried to come back to parent window

My test case is about opening the child window by pressing the button located on main window and closing the child one and after that, i have to press another button which is in parent window but i ...
0
votes
0answers
81 views

Getting Cannot instantiate class error

package com.crm.qa.test; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.crm.qa.base....
0
votes
2answers
47 views

Can't Select random months dates using jquery calender

I have Jquery calender in my application. I have task to select dates from different months using Selenium, but I can do only previous month and forward month. Actually I need to select dates from ...
0
votes
2answers
55 views

How to scroll horizontally knowing that the required tab has no unique ID (Appium using Java)

What I want to do is scrolling horizontally in a tab that doesn't have a unique ID. I have code how to scroll using id and textmatches like this example: driver.findElement (MobileBy....
0
votes
2answers
67 views

Unable to enter text in Twitter using Selenium Webdriver

I'm trying to automate Tweeting using Selenium Webdriver in Chrome. I can login and click the Tweet button, opening the Compose new Tweet box, but when I try to enter text with element.sendKeys(...
0
votes
2answers
61 views

How to get XPath for the text after the <b> tags

I Need to get XPath for the following, to get the text after the <b> tags <li class="SpacedOut"> <b>Name 6:</b> "ABC" <b>Name 1:</b> "BCD" <b>Name ...
0
votes
1answer
23 views

TestNG with multiple datadriven

My code structure logic is this: I have to fill three sequential forms to add a entry in a list whose data is from Excel. I need each form to have entries from different Excel sheet, i.e first form's ...