New answers tagged

1

There will always be some overlap in different tests, but if you look at the test pyramid the different layers have different goals. The test pyramid is a way of thinking about different kinds of automated tests should be used to create a balanced portfolio. Its essential point is that you should have many more low-level UnitTests than high level ...


1

1. you are not passing any driver instance to the Dashboard DashboardPage 2. You are trying to access local variable 'driver' which is not initialized yet Solution: Add : public void launchapp() { driver = new Setup().initializeAppiumServer(); } Or pass the already initialized driver to the dashboard: in your dashboard class also or pass ...


0

I can figure out these things 1- You have not instantiated pageFactory in LoginPage class. Please do it using below public LoginPage(WebDriver driver){ PageFactory.initElements(driver, this); } 2-In loginToCRM class create object of LoginPage as given below. LoginPage loginpage = new LoginPage(driver); 3-Can you also try in ...


0

Yes, you can do it using dataProvider in Selenium. Refer below example: @Test(dataProvider="getFormTestData") public void formTest(String firstName, String lastName, String phoneNumber, String expectedMessage) { /** your code to enter first name */ /** your code to enter last name */ /** your code to enter phone number */ /** your ...


0

You can do it in a simple way. Read the data from CSV and store it in data provider and after that and while writing test pass it as parameter. Below is just an example . @Test(dataProvider = "TestData",priority =1) public void RI_Employer_Information_page(String url,String client) { driver.get(url); WebElement linkclient = driver....


0

Simple answer (but a lots of maintenance in the future): Create IncognitoBaseClass which extends BaseClass, override method instantiateChromeDriver() and make your TestClasses derive from one of them. As you want them. Complex answers (one of them might be good): Create different packages for those tests, and use one for IncognitoTests and secon one for ...


2

You can override you private void instantiateChromeDriver() method in your child class (you have to change access modifier of the method in base class in order to do so) where you can instantiate the driver with the options you need in your child class. Here is a simple model of your architecture: Base class with its own initialization public class Base { ...


0

Why is this not an option? JsonPath resJson= new JsonPath(response); JsonPath referrenceJson= new JsonPath(jsonTOCompare); Assert.assertEquals(resJson.get("fields"), referrenceJson.get("fields"));


0

This is from c# [TestMethod] public void Get_GetServiceTypeList() { string url = "https://XXXX"; string OutPutdata = null; byte status = 0; string ResponsCode = null; var client = new HttpClient(); try { var response = client.GetAsync(url).Result; ResponsCode = ...


0

I think the issues are in the url, try to use a prefix like http:// or http://.


0

You can follow below points in addition of above points for effective test case writing: Written test cases should have a label attached to it i.e. if test case is created for sanity or regression etc. You should be able to easily sort the test cases that can also be achieved if you add labels for modules/features it covers. Test cases should be descriptive ...


0

One way to solve this would be to set up a custom chrome profile in which you disable the download prompt, save it to a specific location inside your project, then use to pass as an argument to ChromeOptions. var options = new ChromeOptions(); options.AddArgument("--profile-directory=AutoUser"); or options.AddArgument("--user-data-dir=C:/Users/...


1

There are multiple reasons for that. But first let's fix this code first: class LoginPage(){ WebDriver driver; //here you have global variable for this page object public LoginPage(WebDriver driver) { this.driver = driver; PageFactory.initElements(driver, this); } } You will want to have access to driver instance. ...


0

You can use the following method to clear text fields, it is tested on different types of input fields public boolean clearTextField(Object locator) { _element = _query.castLocator(locator); if (toBeCleared(_element)) { _element.clear(); } if (toBeCleared(_element)) { _mouse.click(locator); // simulate select all text ...


0

I don’t know you are still looking for solution or you have solved it. You can give it a try with click using Javascript. Click with java script doesn’t depends on that element is loaded properly in DOM or not. So no chance of timeout but you can use Thread.sleep(5000); for give sometime to load DOM. Explicit wait can throw timeoutException. If there will ...


0

Put a breakpoint on this line: WebElement message = driver.findElement (By.xpath("//*[@id='NoChainFound']")); In the browser window, that selenium opened press F12, then type in the console: document.querySelector("#NoChainFound") If the result is null: Switch the iframe and try the query again, like this: The website might require some other user ...


0

If checkbox ID is not dynamic, you can try to have explicit wait for that element's visibility as: element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "myDynamicElement")) Here, 10 is the maximum time to wait and you can increase it at max as per your need.


3

I would say no. My current project has the QA testing using tests in Python while I code in Java. It is using black-box testing. You may also use JMeter for automated testing, which is coincidentally written in Java. If you want to use TDD to created automated build tests, then you would have to know C# to be able to integrate the tests into the source ...


0

If I may be devils advocate, I would suggest sticking with java. If you are the lone automation tester, you can use whatever you want. Advantages to using java: Don't need Visual Studio license Lots more support for Java online Running into an issue with java ? Chances are, someone else posted a solution online Most Selenium users code in Java. Then ...


9

Definetly learn C#. Why? At Selenium tests level it's basically the same thing as Java 9. With a bit of syntactic sugars. It shouldn't take you more than 2 weeks to get up to speed with C#. CI/CD and whole infrastructure is set up for dotnet. If you don't want to run this automated tests manually, you will have to either: configure whole infrastructure to ...


3

Such situations should be addressed both from technical and management perspective, few of the things that needs to addressed are : 1. Does the team consist of only single QA ? If the team consist of just single QA who would be responsible for the entire automation, then choosing a programming language that is alien to current team will create a dependency....


11

You can choose any language irrespective of which language is used in development. But it would be better if you go with same programming language which is used in the development, in your case it would be C#/.NET for below reasons: You can leverage existing libraries used by your team. Developers can help you out, As you said you will the only person doing ...


38

One of the biggest mistakes in my career was to pick a different programming language for the test automation than the development team uses. You won't get help from the development team when you have a programming issue Developers will probably not run, nor maintain tests as they change the application, you will be maintaining and analysing test results (e....


1

I hope what you want to do is : driver.findElement(By.partialLinkText(name)).click() You already have the link text stored in the variable 'name' . So once you are in the target page , use above command .


0

name is a String. It cannot be clicked. The only thing that can be clicked by Selenium is WebElement. You need to find element by some locator that cointains 'name' and then click it. Without DOM and your code is hard to guess how to fix it. It might be something like: WebElement element = driver.findElement(By.xpath("//*[contains(text(), '" + name + "')]"...


0

After storing the name like String name = ad.name1.getAttribute("value") wait untill the value change to aclickable link. Then locate the same element with a different criteria and click on it.


2

Reading your comments I see that app is based on Angular and this: This service appointment has no scheduling dependencies. Does that mean that: First you need to select service appointment (whatver that is) And then check for scheduling dependencies? If yes, then it looks like you need to: Click for something Wait until the element is shown (you can ...


3

It mostly seems like your DOM is changing dynamically, so please use explicit wait using proper locator that uniquely identifies the element you want: The below thread shows the full discussion on 'Element not found': How to analyse 'Element not Found' exceptions when working with Selenium The summary is to : 1. Trust your code and doubt SUT (...


5

This could be a timing issue(as most of the scenario you already discussed) when you're going to find it would not be present at that time on DOM, so you should try using WebDriverWait to wait until this element could be present as below:- WebDriverWait wait = new WebDriverWait(driver, 10); WebElement el = wait.until(ExpectedConditions....


1

I would go with debugging mode, because (response about Chrome won't do anything if you need to test app on IE/Edge/other browser not based on Chromium). Case #1: For instance, I need to manually launch the browser, navigate to the desired page, perform some manual tasks like entering captcha manually and then run the automation script to continue ...


1

For of all thank everyone for your help! The answer was quite simple and I hope some of the senior members dont get mad. In order to access the elements on the second page all I that needed to be done is switch to the correct tab. ArrayList<String> tabs2 = new ArrayList<String>(driver.getWindowHandles()); driver.switchTo().window(tabs2....


2

It seems the second page is opening in a new tab, please switch the tab before interacting with the page: driver.findElement(By.xpath("/html/body/div[4]/div[2]/div[2]/div[2]/div[2]/div[2]/div[2]/div/div[4]/div[1]/div/div/div[2]/div[1]/span[1]/strong/span/div/ul/li[1]/span/a")).click(); ArrayList<String> tabs = new ArrayList<String>(driver....


1

I'm not sure exactly why, but I updated my version of Appium to the v1.15.1 and now things are working. I guess there was some incompatibility of versions somewhere. Anyway, things are working now, which is great!


0

Check your selenium and chrome version. I don't think the issue is related to locator. I tried it in my local and it's working fine. I used xpath //a[text()='VIDEO'] Here's the log. At the last part, you will notice that it locates the element and click it. pool-1-thread-1: Executing get parameters: {"url":"https://mmashare.fullfight.video/viewtopic.php?t=...


4

I have substantially simpler approach/solution than JAINAM's answer. When I needed similar "in the middle" manual actions, I added (in Python) break to Python debugger. Execution stopped, I did desired manual actions (you can even load another page) and then I resumed the execution. Easy-peazy.


2

You can use JAINAM answer , or As you are using java , you could add a pop window that pauses your test till you finishes the manual part and resumes the code. import javax.swing.JOptionPane; //your code //Pop while doing, your manual stuff int choice = JOptionPane.showOptionDialog(null, "Ready to resume the scripts?", "Please confirm", ...


5

You can use Chrome DevTools Protocol. Try with below steps: Add path of Chrome executable to environment variable PATH. Launch Chrome with custom flag, and open a port for remote debugging chrome.exe --remote-debugging-port=1111 --user-data-dir="C:\selenum\AutomationProfile" You can now play with the browser manually, navigate to as many pages, perform ...


-1

That's not possible. Selenium needs to start browser driver in order to manipulate it.


0

I'm not sure about Selenium picking up on your existing browser pages/session. From the question I assume you need/want to run these tests locally and not in some virtual browser or server? In that case, a different way you could achieve this is: Take the script that you have, let it start a session in a browser and immediately afterwards include a ...


0

You need to instantiate driver in BaseClass. You need to intialize the elements using PageFactory class in LoginPage constructor. public LoginPage(WebDriver driver) {           this.driver = driver; PageFactory.initElements(driver, this); } Create LoginPage class object in test as LoginPage loginpage = new LoginPage(driver);


Top 50 recent answers are included