Questions tagged [java]

Java, renowned as a cutting-edge, object-oriented programming language, is here to unriddle any enigma perplexing you in its intricate domain. Consider applying this tag when grappling with the essential nuances or comprehending the coding syntax. This label seamlessly aligns with accompanying tags that embrace libraries and frameworks diligently harnessed by skilled Java developers.

Having difficulty selecting an element with Selenium in Java

I am encountering difficulties with retrieving and utilizing a Select element using @FindBy. Here is the markup: <td> <felt [control]="kontactTypeFC" [classes]="'hb-distNone'"> <label for="contactTypes" class="hb-label"& ...

What should I do when faced with an unexpected alert while using the Selenium Driver?

Currently, I am working on testing the functionality of www.uhc.com using Selenium with Java and Chrome browser. The website includes a random pop-up that appears while the script is executing, prompting the user to take a survey with just yes or no opti ...

Encountering a memory issue when trying to parse a hefty JSON file using the Jackson library in an Android

Currently, I am facing a challenge with parsing a substantial JSON response from the server using the Jackson library. The size of the JSON file is approximately 7-8 MB. The error that I encountered while running the code snippet below: ObjectMapper mapp ...

Having trouble interacting with element - Selenium WebDriver is not allowing the click

I'm attempting to select the Checkout Button. This is what it looks like : https://i.stack.imgur.com/TiMEO.png And here's the HTML snippet for it : <div id="buy-button-next"> <span data-reactroot=""> <div data-cid="buy- ...

Using Ajax to update a `p:selectOneMenu` based on the selection in another `p:selectOneListbox

I've been facing a challenge with a seemingly simple task that just won't cooperate. Here's the scenario: I have two "p:selectOneMenu" components, where the items in the second one depend on the selection made in the first. Each of these components has it ...

Running a Selenium project on a WebLogic server

I am interested in developing a selenium project for conducting Sanity testing on one of our client applications. The plan is to create a Dynamic Web Project and deploy this selenium project on the server so that anyone can easily launch and execute test c ...

The error message indicates that the Worklight adapter is an object, not a function

Upon deploying the Worklight adapter to the production server, I encountered an error when the adapter called a Java code from JavaScript: Procedure invocation error. Ecma Error: TypeError: Cannot call property updateProposal in object [JavaPackage com.id ...

Is it possible to leverage Robot Framework for automating web and mobile applications, enabling simultaneous execution?

Is it possible to run both web and mobile applications simultaneously using the robot framework? If so, how can this be achieved? If we include libraries for both web and mobile applications, how does the robot framework differentiate between the two? Do ...

Google App Engine - Passing server side data to the client side: Tips and Tricks

When working with Google App Engine, there is a specific object or model called "Car" that resides on the server. This "Car" object possesses various properties such as "Model", "Year", and more. The task at hand involves transmitting information of the "C ...

Tips for resolving SSL certificate errors when using Selenium WebDriver with Internet Explorer

Currently, I am a beginner in utilizing Selenium Web Driver with Java. Successfully launching an application, but encountering SSL certificate errors. Seeking guidance on how to address this obstacle as I continue to learn and prepare for implementation at ...

Capturing the shouldBe or shouldHave method in Selenide

I am in the process of creating a test, but I am encountering issues with loading all fields correctly. My initial thought was to use a simple try/catch method, however when I include the following code: $("select[formcontrolname=\"identifier\"] ...

Exploring Ancestors with Jquery to Find Input Fields

In my current project, I am working on a function that needs to extract the values from two input fields within a specific div element. These values will then be added to an array and posted as JSON data. However, I am facing difficulties in navigating thr ...

Tips on how to automatically scroll to the newest item added to a growing list

I am facing a challenge with Selenium where I need to scroll to the last element on a list within a modal window. Despite trying various methods, such as: // 1. driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL, Keys.END); // 2. j ...

Single Linked List - retrieve and insert functions

Today I'm tackling the challenge of implementing an SLList class by completing operations such as: get(i), set(i, x), add(i, x), and remove(i), all designed to run in O(1 + i) time. The areas where I'm encountering issues in my program are part ...

What is the best way to split a string based on multiple delimiters?

Can someone help me extract the text 18-Aug-2019 14:00 from Egypt Today Last Update Time: 18-Aug-2019 14:00 (GMT)? I tried splitting at ":" as my first step, followed by splitting at " (" (essentially 2 splits), but that approach is not working. Is there a ...

Is there a way to incorporate a progress bar into the Java file uploading example?

I'm currently developing a JSP/Servlet web application and I am looking to implement file upload functionality with a progress bar within a Servlet context. Below is an example of uploading a file using JSP and Servlet but without the progress bar fea ...

What is the correct way to implement a variable in xpath with Selenium WebDriver using Java?

How can I incorporate variables into XPath while using Selenium WebDriver with Java? Below is the snippet of my code: for(int row =1; row<=20; row++) { driver.findElement(By.xpath(“//*[text()=’PickRequest’]/table/tbody/tr[+row+]/td[2] ...

Unable to start the AndroidDriver

This chunk of code is giving me trouble: WebDriver driver; driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); I keep encountering this error: The type org.openqa.selenium.remote.service.DriverServi ...

I would like the capability to choose a roster of gods depending on a character's class and moral orientation

I am in the process of developing a character sheet for Dungeons & Dragons, and I'm looking to pass the values from two drop-down menus into a query that will then populate another select list. Despite trying various methods to retrieve the data, I keep en ...

Can I receive the latest trending topics from YouTube?

My current project involves tracking the latest trends on Youtube. I am looking for a way to retrieve the JSON Object so that I can integrate it into my Java code efficiently. ...

After transitioning an application to Spring Boot and implementing Spring Data Rest, I noticed that entity properties annotated with @Id are no longer included in the JSON marshalling process

Looking for some help regarding an issue related to a specific question on Stack Overflow (Spring boot @ResponseBody doesn't serialize entity id). I recently migrated my application to Spring Boot and started using the spring-boot-starter-data-rest de ...

Encountering a java.lang.NoClassDefFoundError related to org/hamcrest/SelfDescribing while using Maven

I tried to execute the junit webdriver example from sauce labs, but encountered an error while running 'mvn test': java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing This is the complete pom.xml: <?xml version="1.0" encoding="UTF-8"?> &l ...

Transforming Errors to JSON

Can an Exception object be converted into Json in Java 7? For example: try { //something } catch(Exception ex) { Gson gson = new Gson(); System.out.println(gson.toJson(ex)); } ...

Retrieving the innerHTML or innerText of a structural DOM element generated by *ngFor in Selenium

Having trouble accessing the innerHTML/innerText of a structural DOM element, only getting a commented element instead of the child elements. <div class="snap-box"> <label class="snap-heading">Recommendations</label> <div class="r ...

Managing timeouts and errors in a Spring and Vue login systemIn this system,

I am currently working on developing a back-end using Spring and a front-end with Vue. Both projects are separate but running on the same machine. I have managed to resolve or disable all cors, csrf, and login issues except for one that has left me complet ...

Getting the percentage of code coverage in Selenium tests in relation to the web application code

I need to track the code coverage of my selenium tests in relation to the source code of the server (web application source code) that they cover. For instance, I want the tests for the login feature to measure how much of the web application's code is co ...

Encountering issues with Gzip compression in my Spring Boot 1.5.10.RELEASE project

I am currently running on Spring Boot version 1.5.10.RELEASE, but I'm facing issues with Gzip compression not working correctly. When accessing http://localhost:9000, it redirects to http://localhost:8080/api/.. My AngularJS and REST API are on dif ...

Is it possible to stop an AjaxBehaviorEvent listener or send extra information to the f:ajax onevent function?

In the controller, I have created a listener that looks something like this: public class FooController { public void doSomething(AjaxBehaviorEvent evt) { closeDialogFlag = true; .. if(!isValid){ closeDialogFlag = f ...

JSON is not conforming to the standard nesting level

After simplifying, the JSON implementation is as follows: Data(Entity)->"data"->another Entity I originally thought I could decrypt the Data object first, extract a type from it, and then use that type to decrypt the necessary type from the String "d ...

How can I troubleshoot the RegistryBuilder problem encountered during Junit testing with Maven?

I recently created a test in Juni and added it to my Maven project. However, when I try to build the project, I encounter the following error: java.lang.NoClassDefFoundError: org/apache/http/config/RegistryBuilder at org.openqa.selenium.remote.int ...

Selenium WebDriver test for an Oracle ADF Task Flow application is failing on Internet Explorer 11

While I have successfully run a Selenium WebDriver test on Firefox and Chrome, the same test surprisingly fails on Internet Explorer 11. Upon investigation, it seems that the issue stems from using AJAX, as IE does not update the DOM Tree properly after an ...

The if block's condition is only evaluating the first statement and not the second statement

When attempting to log in, I need to enter a username and password. If the "I Agree" element is not displayed or the "admin header" element is displayed, I want to click on the admin element. However, my code currently only checks if the "I Agree" elemen ...

The controller remains unresponsive when attempting to activate the button on the webpage

I'm a beginner in frontend development and I'm currently working on a website that uses Thymeleaf. On this website, there is a div block with a button. Please take a look at the HTML code below, specifically the button at the last three rows. <form th: ...

Implementing parallel execution with POM (Page Factory) for updating records

Looking for some help as I couldn't find a solution to my issue. I'm having trouble running tests in parallel using POM with page factory. *\ Testbase class */ public WebDriver driver; @BeforeClass @Parameters("Browsername&qu ...

Struggling to input data into Excel using Selenium WebDriver

I encountered an issue while attempting to write two strings to an Excel sheet using the following code. The error message I received was: java.lang.IllegalArgumentException: Sheet index (0) is out of range (no sheets) FileOutputStream fout=new FileOutput ...

Using jQuery to send a post request to a servlet and then refreshing the parent

As I dive into the world of ajax jQuery documentation, my goal is to send a post call to a servlet that I have created in order to save an entry in my database. Once the post is successful, I aim to reload the parent of the iFrame responsible for rendering ...

There appears to be an issue where the session object cannot be retrieved by the Struts2 action

I have a struts2 action that is invoked by a JavaScript function. The JavaScript function uses uploadify to enable multiple file uploads: <script type="text/javascript"> $(document).ready(function() { $("#fileupload").uploadify({ ...

Unfamiliar String Conversion to JSON in Java

Need assistance with parsing a JSON-formatted string obtained from a URL. The field and size of the data may vary, making it difficult to iterate over the structure of the JSON object. Here is an example of the string: {"_index":"my_index","_type":"my_t ...

What is the best way to retrieve a file from a website that requires a login and password, utilizing the Selenium framework?

I need to access a password-protected file from a website using Selenium. To start, I extracted the download link's href attribute: WebElement downloadLinkElement = htmlElement.findElement(By.xpath(<xpath_value>)); String url = downloadLinkElem ...

Mastering the art of utilizing CallBackScript effectively in Wicket 6.x

Back in the days of Wicket 1.x, I utilized an AjaxEventBehavior to implement a CallBackScript that provided me with the mouse coordinates. Here's a snippet of what I used: (getEventX() and getEventY() are JavaScript Functions) myObject.add(new AjaxEve ...

The process of linking a JsonObject attribute to XML using MOXy

I am currently working with the following class structure: @XmlRootElement(name = "Root") class MyClass { @XmlElement(name = "Entries") JsonObject getProperty() { ... } } My goal is to generate the following XML output upon marshalling: <Roo ...

Is it possible to handle an item within a JSON as a string?

Currently, I'm tackling a Java project that involves handling JSON data structured like this: { "objectList" : [{...}, {...}, ...], "metadata" : {...} } My goal is to extract the object list and metadata as JSON strings. In essence, I ...

Using Selenium to input text into the password input field

I am encountering an issue while attempting to log in to my profile. The problem arises when I try to input the password as the cursor appears in the password box, but an exception is thrown when trying to send the keys. Could this be due to a security mea ...

Include certain variables in the JSON response within the Aspect

Our goal is to include some variables in the JSON response, embedded within a specific aspect. We are looking to implement a process similar to this function, but focusing on modifying the response rather than the request. ...

Is it possible to run both TestNG (group) and Cucumber (tag) tests simultaneously using a single command in Maven?

I have encountered a challenging issue that has left me stumped despite numerous attempts to solve it. The current setup involves a testng framework for GUI testing, where tests are executed based on groups in a maven command. I have been tasked with creat ...

Maximizing Data Retrieval with Selenium for Optimal Efficiency

Currently, I am working on developing a Selenium code using Java with the following functionality: Open a browser and navigate to a specified URL. Locate the search box on the webpage, enter the keyword polices, and initiate the search. The search result ...

From Android JSON array to a list of items

In my android app, I have encountered an issue while trying to parse a JSONArray into an ArrayList. The PHP script returns the expected results correctly, but when attempting to add the results to the ArrayList in Java, a null pointer exception occurs at ...

Solr Time Conversion

Having a dilemma with Solr dates: Here is the format of my time frames: TimeFrame_From:2018-02-28T05:00:02.0Z TimeFrame_To: 2018-02-28T06:00:02.0Z I've created code using the SimpleDateFormat function. public void validateParameters(String TimeFra ...

Discovering a web element: A guide

Couldn't locate a specific element on the webpage https://cloud.google.com/products/calculator/ Trying to find and interact with the 'Number of GPUs' element on the aforementioned site, then select '1' from the dropdown menu that ...

"Encountering a NullPointerException on Android while trying to parse JSON data fetched from

Encountered an issue while attempting to link phpMyAdmin with MySQL database in Android programming. Here is the segment where I endeavored to receive the output from my php method: public boolean obtainLogin(UserModel userModel) { String username = u ...

Tips for utilizing one catch block to handle both TestNG assertion errors and RunTime exceptions

In my TestNG framework with Java and Selenium, I have created two custom methods to handle WebElement interactions. Here they are: // Checks if a WebElement is present on the screen public boolean isElementPresent(WebElement element) { try { e ...

Using Selenium with Java allows for the seamless passing of a Browser instance to another method

Currently, I am in the process of automating a web task using Selenium and Java. As a beginner in both Java and Selenium, I have encountered an issue with passing a Browser instance to a called method. My main method opens a webpage, performs some tasks on ...

What is the best way to parse this JSON using Jackson?

My JSON data is structured like this: { "summary":{ "somefield1":"somevalue1", "Twilio":{ "field1":"value1", "field2":"value2" }, "Tropo":{ "field1":"value1", "field2":"va ...

Exploring the function of Selenium in validating email addresses and passwords

Our new ecommerce website includes an exciting feature where automatic emails are sent to customers after they place their orders. To ensure this function is working properly, it’s important to test whether the customer actually receives the email and ...

Utilizing a Batch script to manage temporary folders in automation tests with Selenium

Frequent running of selenium tests leads to the accumulation of numerous 'anonymous-web-driver' profiles in the temp folder for Firefox and 'scoped-dirs' for Chrome. To address this issue, I devised the following batch script: @echo off cd %temp% for /d ...

Tips for choosing a dropdown option using Selenium WebDriver?

I am attempting to automate the selection of a drop-down menu using Selenium WebDriver. Below is the code snippet I have written: package Select; import org.testng.annotations.Test; import java.util.List; import java.util.concurrent.TimeUnit; import org ...

Finding an Element By ID proves to be a challenging task in Selenium

I am struggling to find the login ID using Selenium. I was able to make it work on a Windows computer previously, but now that I'm trying it at home on my Mac, I'm unable to locate the element by its ID. Even after implementing driverwait as suggested by m ...

Having trouble creating the right XPath for the top movies on IMDB using Selenium

I'm having trouble clicking on the Top Rated Movies section within "Movies, TV & Showtimes" on IMDB. I'm unsure of how to write the correct xpath for it and can't seem to figure out how to click on it. Below is the snippet of code I am using: driver.get( ...

Utilize the Jackson library in Java to import a JSON URL and parse its contents

I am currently attempting to read and parse a JSON link using Java in order to utilize it for various purposes. However, I am encountering errors that are leaving me uncertain on how to proceed. Below is the snippet of code I am working with: package weat ...

Dealing with null values from JSON when a list view row is clicked: Tips and suggestions

My knowledge of Java is limited, but I managed to pull data from an API to a list view successfully. However, when trying to display more details upon clicking on an item in the list view, I encountered errors related to handling null results in my text vi ...

Guide on setting an attribute value with JavaScriptExecutor in Selenium WebDriver

I am attempting to set an attribute value for all instances of the same type of <img> tag on My website, for example: <img src="images/temp/advertisement.png"> and I want to set style="display: none" so that I can hide them. I have tried the ...

Issue encountered with geckodriver: Unexpected argument '--websocket-port' was detected

I recently updated my Selenium project using the Bonigarcia autodownload webdriver project to the latest versions. I upgraded to Selenium 4.0.0 from Maven repo and also updated the Bonigarcia project to version 5.0.3. However, now when I try to run my test ...

What is the best way to add a "descendant" clause alongside an xpath variable?

Here's a snippet of the code I'm working on: public void someTest() { String x = "/html/body/div/div["; String y = "]/a"; for (int i = 1; i < 5; i++){ String links = x + i + y; driver.findElement(By.xpat ...

Encountering a null pointer exception when attempting to declare a WebElementFacade within a page object

While attempting to implement the page object model in Serenity BDD, I encountered a null pointer exception when declaring WebElementFacade in my page object. Below is the code for my page object class: package PageObjects; import net.serenitybdd.core.an ...

Error message: "Execution of taskkill executable not found in Selenium WebDriver"

Every time I run the driver.quit() command, it successfully opens and quits the firefox browser but I keep getting an error message saying "Unable to find executable for: taskkill". I have already set the environment variable PATH to "C:\Windows&bso ...

Navigating through a list of options and selecting one results in selecting the incorrect option

I've encountered an issue in my web driver test where I am scrolling down a menu list and clicking on an item, only to find that it navigates me to the wrong link. It seems like it's actually registering the click on a menu item at the top of the ...

Converting JSON into Java POJO objects with a dynamically generated key

I'm currently in the process of converting JSON to JAVA POJO. The JSON string I'm working with is structured as follows: { "api": { "results": 1, "fixtures": [ { "fixture_id": 38480 ...

Steps to select a radio button according to the provided HTML code

Incorporating the code snippet below as a reference, I am attempting to implement functionality for a radio button. <input id="checkmo" class="radio" type="radio" data-bind="attr: {'id':getCode()}, value: getCode(), checked: isChecked, click: ...

Tips on analyzing two lists that have unique identifiers yet contain identical information

I am dealing with 2 lists that have the same content but reference different names. There is a table I can download with an 'Export' button, which saves a CSV file to my local system. I am using Selenium to retrieve the table data and I have att ...

Is it possible to verify and access a downloaded file using Selenium?

My task involves checking a downloaded PDF and opening it using Selenium. To achieve this, I am utilizing the Robot class. However, this method is not a permanent or general solution. Query: Could someone assist in providing a more reliable solution for t ...

Get the file from the web browser

Hey there, greetings from my part of the world. I have some straightforward questions that I'm not sure have simple answers. Currently, I am working on a web application using the JSP/Servlet framework. In this app, users can download a flat text file tha ...

Encountering issues with the transmission and retrieval of ajax data in Struts 2 framework

Currently, I am attempting to transmit data through ajax and then retrieve the same using ajax. Below is the snippet of my ajax code: $.ajax({ url:"getSampleData", type:'GET', data : {'var':cellValue}, ...

Is it possible that Selenium struggles to locate links, buttons, and text within a GWT framework?

I recently attempted to test my GWT web application using Selenium. Using the Selenium IDE Firefox plugin, I recorded a sequence of actions (registration -> login -> logout). However, during the logout step, the test consistently failed because Selenium ...

Can an Angular 5 web application be developed without using Node.js/npm?

I want to develop an Angular 5 web application using Java, but my boss prefers not to use Node.js/npm. Is it possible to build an app without Node.js/npm and rely solely on Java? Most of the resources I've come across recommend using Node.js/npm, inc ...

Trouble accessing the browser - Session Creation Exception occurred

Here is a problem with the testcase code that I can't seem to get it to execute properly. Is there a configuration issue related to Firefox? package testOperations; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.sel ...