All Questions
60 questions
0
votes
1
answer
7k
views
Cannot invoke "org.openqa.selenium.SearchContext.findElement(org.openqa.selenium.By)" because "this.searchContext" is null error
I am trying to verify a functionality as a guest user and logged in user. In order to do that I log out form the system and verify the guest user actions then login again and verify logged in user ...
0
votes
1
answer
138
views
How do i get rid of duplicated local variables
I have a multiple drop-downs and need to automate them.
I added the code below, how do I add them in one step?
or
make it easier
or
how do I add them in one function?
I'm using eclipse and TestNG ...
0
votes
1
answer
222
views
Why dont we use the main() method in TestNG class?
public class Tests{
@Test
public void run(){
sop("this is test method 1");
}
}
How will Jvm know about entry point of the program? 🤔
2
votes
2
answers
3k
views
java.lang.UnsupportedClassVersionError -CucumberJvm4SMFormatter -Java runtime Version error
My testing framework is built with Cucumber, TestNG, Java 1.8 and Maven
I recently updated my IntelliJ IDE
Details: IDE : IntelliJ IDEA Ultimate 2020.3 - Runtime version : 11.0.9
Cucumber is ...
1
vote
1
answer
572
views
Automated testing of Google Pub/Sub
I'm new to test automation and Google Pub/Sub. I'm developing automation scripts for regression testing. My automation framework is built with Java, Maven, Cucumber and TestNG
My application is a ...
0
votes
1
answer
4k
views
Cucumber- Selenium Getting null pointer exception while openBrowser method
I am getting null pointer exception when selenium tries to launch the browser.
I have already checked step Definition.
Selenium OpenBrowser Method.
Chrome browser version. ( I have driver 87.04 ...
1
vote
1
answer
1k
views
Null Pointer Exception Error at Selenium TestNG
I'm trying to automate the search box but I'm getting null pointer exception.
package LICT.Maven_ReCheck_Search;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import ...
0
votes
0
answers
3k
views
Not able to run my test from testng.xml file
I'm not able to run by test case from testng.xml file after run of file I'm getting that Total tests run: 0, Failures: 0, Skips: 0 but if I will try to run the test class directly then test will run.
...
2
votes
1
answer
2k
views
testNG, Java: How to combine a few Data Providers in one test?
In the provided test I need to read the data from the cell in Excel and it works.
I would also like to add the functionality to store the price of the product in another cell in the Excel.
I've split, ...
0
votes
1
answer
781
views
TESTNG, how to validates test case results to pass fail status [duplicate]
Need help, my question here is how can I code it such when the result is not expected testNG will display the test case as failure/fail? if the result is expected test case result is passed?
very new ...
2
votes
0
answers
337
views
BeforeClass doesn't get displayed in TestNG test results window
We are expanding our TestNG suite to run multiple tests. Doing so we've encountered a strange occurrence.
In one suite I have two tests. Both tests have one class each. Tests in IntegrationTest.java ...
1
vote
1
answer
2k
views
How to select a dropdown value in Selenium WebDriver using Java appium?
I am new to Selenium, currently am working on selenium webdriver. I want to select a value from the drop-down. But I am not able to do it because of some error. Also, I want to inform you that in my ...
0
votes
2
answers
618
views
How to rerun failed test from where they instead of from beginning? (TestNG)
Is there any way to re run the failed testcase from the page where it got failed instead of running the testcase from beginning in Selenium Java ?
1
vote
1
answer
219
views
In gradle 4.6, how to force all tests in a class gets executed first before moving to tests in next class?
I am using Gradle 4.6 with testng. My test suite has tests organized something like these.
java class1
{
test 1.1
test 1.2
test 1.3
test 1.4
}
java class2
java class3
java class4
java class5
All ...
2
votes
1
answer
33
views
Unable to get multiple browsers working with Chrome and IE Edge browsers
I'm new to QA testing.
I was practicing automating test case in TestNg, but can't seem to get the cross browsers to work. The test keeps failing.
It worked when it was just one browser. Any ...
-1
votes
1
answer
74
views
How to validate test logic for date dropdown?
I have a close date field where the date is already populated, and a date creation field which is the actual activity creation date and the logic I want to validate is below -
Validate that the ...
0
votes
1
answer
261
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
1
answer
45
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 ...
-1
votes
3
answers
751
views
Getting Null pointer expections " java.lang.NullPointerException "
[RemoteTestNG] detected TestNG version 6.14.3
1553664942228 mozrunner::runner INFO Running command: "C:\Program
Files\Mozilla Firefox\firefox.exe" "-marionette" "-foreground"
"-no-remote" "-...
0
votes
2
answers
3k
views
Using TestNG framework : How to call other class of the methods
Using TestNG framework : How to call other class of the methods
I have created one class for login and another class for add customer details.
My scenario is:
Once user login after add customer ...
2
votes
2
answers
77
views
Getting Nullpointer Exception
While i run this below code i am getting Null pointer exception.
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import ...
0
votes
1
answer
45
views
after click on submit button record will added to the table, so how to verify that record is added or not in the table
There is add employee form, so how to verify the record, should I match the all fields of form which display on table or just match the name, also table is dynamic with pagination.
-2
votes
1
answer
4k
views
Getting error message while running selenium script
I am facing this problem, please give me a solution
[RemoteTestNG] detected TestNG version 6.14.2
Starting ChromeDriver 2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5) on port 7027
Only local ...
0
votes
1
answer
2k
views
Can't able to run TestNG its show an error below I mentioned
[RemoteTestNG] detected TestNG version 6.14.2
org.testng.TestNGException:
Cannot instantiate class testing.test
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:30)
...
0
votes
1
answer
260
views
Simplifying Setup of TestNG/Selenium WebDriver Test Classes (using Google Guice?)
I am developing test cases using Selenium and TestNG, and am following the Page Object Model design pattern.
Currently, my page classes look like this (Page1 is just a placeholder, they all have ...
0
votes
1
answer
129
views
I need to verify a dynamic table record, if they match with data then PASS else Fail the test case using Assert
Page Object Class
public class Transactions {
WebDriver driver;
boolean result1;
public Transactions(WebDriver driver) {
//super();
this.driver = driver;
}
public void ...
0
votes
2
answers
5k
views
How to pass the web driver instance from one testcase class to another testcase class in TestNG?
InitializeDriver.java:
public class InitializeDriver{
WebDriver driver;
public WebDriver getDriver() throws Exception{
driver = new FirefoxDriver();
System.out.println("Initialize ...
0
votes
5
answers
13k
views
Print all product details in search results using Selenium Java
I am trying to print product details from searched results from this page.
This is the function I used for that.
@Test(priority = 1)
public void printSearchItem() {
// print the product details
...
-1
votes
3
answers
3k
views
How to click on the image inside a grid using selenium webdriver?
I have to click on an image inside a grid. Grid elements have dynamic ID's. Therefore it's impossible to capture elements as usual. How can click on this image?
I have boxed the image I ...
0
votes
1
answer
422
views
TestNG + Appium + Java : [TestNGClassFinder] Warning: Can't link and determine methods of class
Question:
How to fix : [TestNGClassFinder] Warning: Can't link and determine methods.
More info:
My Automation is getting failed suddenly. I know it was working well before & even yesterday. Tried ...
0
votes
2
answers
4k
views
Selenium Webdriver TestNG (Java) using While loop for all tests
I am new to Selenium Webdriver Testng and trying to Develop Data Driven framework using CSVReader
I have 5 tests in Testng and have to run those all on different environments. So basically I have to ...
0
votes
3
answers
1k
views
Why my code is not working when I click on the same button for multiple times?
I have same Skip button types kept for 99 products. When I need to click that, it will bring a popup. In the popup I need to click the Cancel button. Each time when I click on the Skip buton it will ...
1
vote
4
answers
19k
views
How to resolve NoSuchElementException in Selenium with java?
CODE:
driver.findElement(By.name("USER")).sendKeys("XYZ");
driver.findElement(By.name("PASSWORD")).sendKeys("abc");
I have tried various ways not just name but by xpath, css selectors but every time ...
1
vote
0
answers
987
views
How to control order of testNG package test execution without Priority or Dependency?
I have a package containing the tests I want to run. There are no priority or dependency setings at the testcase or suite level.
<suite thread-count="1" name="reg 1">
<listeners>
...
1
vote
4
answers
3k
views
How to solve java.lang.NullPointerException error in button click event?
I'm using Java,Selenium web driver and TestNG framework. I have a method to click a button in web page. But it didn't work. When debugging I could find xpath is not passed to the button. Then I tried ...
3
votes
2
answers
76k
views
How to find a button using both xpath and button text?
I have three buttons withing a div. All three buttons belong to same class (class names are same). What I want to do is capture each button using its text (Buttons have different texts) and xpath of ...
2
votes
3
answers
26k
views
How to print a message after checking through TestNG's Assert.assertEquals method?
I'm getting a string value from a function. Now I want to print a message saying whether expected string and actual string are different or not.
To compare these string I'm using TestNG's Assert....
3
votes
0
answers
1k
views
How can I make my solution thread safe for testNG parallel execution?
Background: For quite some time I have ran automated tests using forked JVM processes, this proved quite easy when injecting a driver object using spring, I could simply provide the following:
@Bean(...
0
votes
3
answers
484
views
Cannot set Screenshots on test Listeners - selenium
I am creating TestFramework and want to set in TestListener class the method which take screenshots but during failed test the Browser closes, another browser is opened and the screenshot is created (...
1
vote
2
answers
7k
views
How to use dependency in TestNG with two test cases from two different classes?
How to use dependency in TestNG with two test cases from two different classes?
For Example, I have two classes:
package com.test.class
public class A{
@Test
public void testA(){
}
}
...
2
votes
1
answer
1k
views
Is there any ways to run any method or line of code after @AfterSuite in TestNG?
I am having below configuration,
Maven project
Execute test case through testng.xml
External code to write report
Here I have write code to generate reports. It depends on complete all test cases ...
-2
votes
2
answers
959
views
How to resolve Nullpointer exception [closed]
Here is my code:
General.Java:
package com.hrms.lib;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.openqa....
1
vote
1
answer
215
views
How to extract adb dumpsys response for validation?
I need to validate few status of the android device. Can any one let me know how to extract the information from adb dumpsys and validate the responses using Java. Your help is much appreciated.
Ex: '...
0
votes
1
answer
819
views
How do I execute multiple test class parallely. which using same function in another class using testng
How can I execute multiple test class 'test1' and 'test2' parallely? Which is using the same function in another class using TestNG.
When I define the parallel option as 'classes' and thread-count as ...
0
votes
1
answer
719
views
Execute TestNG.xml file from Build.xml(ANT)
Below is my Build.xml file. I am trying to execute my TestNG.xml through Build.xml but I am getting the below error every time:
[testng] Cannot find class in classpath:
The below file is working ...
0
votes
3
answers
2k
views
Creating UI to run my tests
I run my test using Java, Selenium and TestNG.
When I execute my test suite I have it set up where the testng.xml has all the configurations to run my tests. I am wondering, if I can set up some UI ...
1
vote
1
answer
9k
views
Showing NoClassDefFoundError after executing testng.xml file through command prompt
I am trying to execute a testng.XML file through the command prompt which I will use later in Jenkins with the batch file.
Executed XML file gives me the following exceptions.
C:\Users\Vinay\...
1
vote
1
answer
2k
views
Why doesn't testNG assertion message get printed after each test in data-driven testing?
I am running Data-driven tests driven from a spreadsheet which are input to TestNG test Framework. In a nutshell, the framework traverses through outlook mailbox and looks for mails based on the ...
4
votes
6
answers
12k
views
How to run same test case of testng on 100 different URL/Domain?
I have one difficult scenario for automation testing.
I want to run one test cases for 100 different URLs/Domain.
Precondition :
Script is generalize and running individuality properly.
Use of ...
4
votes
3
answers
14k
views
Selenium WebDriver tests sometimes doesn't find elements
I am pretty new to all the Automated Testing thing and recently I have been having trouble with selenium because sometimes fails finding certain input fields / buttons.
I added explicit waits for ...