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.

The functionality of "Expectedconditions.not" in Selenium Webdriver is not performing as anticipated

WebDriverWait wait = new WebDriverWait(driver, 60) WebElement element = driver.findElement(By.xpath("//div[contains(text(),'Loading...')]")); System.out.println("Test"); wait.until(ExpectedConditions.not(ExpectedConditions.presenceOfElementLocated(By.xpat ...

Developing J2EE servlets with Angular for HTTP POST requests

I've exhausted my search on Google and tried numerous PHP workarounds to no avail. My issue lies in attempting to send POST parameters to a j2ee servlet, as the parameters are not being received at the servlet. Strangely though, I can successfully rec ...

Exploring the capabilities of IBM Integration Bus in handling JSON parsing operations

Hello, I am currently facing an issue with parsing JSON data in the IIB Toolkit. The error message thrown by the java compute node is: "java.lang.NoClassDefFoundError: org.json.JSONObject" When attempting to parse incoming JSON messages using UTF-8 encodi ...

Can anyone provide guidance on how to navigate and locate this specific element using Selenium within a Java

How do I locate the value 1352 using Java Selenium on ChromeDriver? <span class="numfound" id="yui_3_18_1_1_1522936314968_15">1352</span> The id is not intuitive, so I want to select by the String "numfound". I attempted selecting byClassName ...

Initializing JBrowserDriver can be quite time-consuming, often taking over a minute to complete

Currently, I am utilizing JBrowserDriver to capture screenshots from various pages. However, a noteworthy issue arises when I initialize the driver variable as it takes a considerable amount of time, approximately 70 seconds. JBrowserDriver driver = new ...

Tips for identifying the existence of an element using Selenium WebDriver in Java

When attempting to use Selenium WebDriver's findElement() function to check for the presence of an element on a page, I encounter issues where Selenium exits the code even when handling exceptions with WebDriverException. Although I tried implementin ...

In Java, we can convert the ISO date format to the desired format

Is there a way to change the existing ISO Date format into a different required format? The current MongoDB Iso date is 2016-08-31T08:30:17.795Z The desired format needs to be: Aug 31, 2016 08:30 AM ...

Unable to make an AJAX call to a Spring controller

I am currently attempting to make an ajax call to a Spring controller, but I am encountering an Error 405 stating "Request method 'POST' not supported." I have included my code below and would appreciate any suggestions on how to resolve this issue. Here ...

Unable to execute TestNG programmatically due to difficulties in creating an executable JAR file

Looking to create an executable jar file from Selenium TestNG code. import org.testng.TestNG; import com.test.Utility.ExtentReporterNG; public class JarCreator { static TestNG testNg; public static void main(String[] args) { ExtentReport ...

Is there a way to check for duplicate images in my database before allowing the user to upload them? (java)

I am facing some major challenges and I am hoping for some assistance. I would like to implement a feature where the system compares an image before it is uploaded by the user. If the image already exists in the database, the user should not be able to up ...

Tips for modifying the JSON format within a Spring and Angular project

I am utilizing Spring for the backend and Angular for the frontend. Below is my REST code: @GetMapping(path = "/endpoint") public @ResponseBody Iterable<Relations> getGraphGivenEndpointId(@RequestParam(value = "id") int id) { return ...

Looking for a unique specification of JOLT for JSON input in an array

I am currently tackling the challenge of transforming a complex JSON using JOLT. The given JSON is as follows: { "data": [ { "fieldname": "Name", "fieldvalue": [ "John Doe" ...

Selenium reports an error with the xpath used for the span element,

HTML : <div class="accept"><a class="red_keep popup_action"><span>Tap here to see the terms</span></a></div> Xpath attempts : 1. //span[text()='Tap here to view terms'] 2. normalize-space(//href[@class="red_keep popap ...

Use Selenium to locate the element through the label

Here is the html code snippet that I'm working with: <label class="error" id="field">Invalid format </label> I have been attempting to retrieve the value Invalid format using this command: System.out.println(driver.findElement(By.id("fi ...

The program encountered a java.lang.NullPointerException error stating that it is unable to call the method "org.openqa.selenium.WebDriver.findElement(org.openqa.selenium.By)" due to the null value of "this.driver"

Help Needed: Error Message: java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.WebDriver.findElement(org.openqa.selenium.By)" because "this.driver" is null Below is the code and a screenshot of the error: https://i.stack.imgur.com/A7F49.p ...

Tips on shifting the focus of Selenium to a newly opened tab?

When I click on a link, it opens in a new tab. My goal is to switch to that tab, close it, and then return to the original parent window. I've tried the following code but encountered an error. It seems like the control is not moving to the child window a ...

The method Element.getText() will return an empty string

This image displays a field that is pre-populated from the API, and I am attempting to automate it using the command below. Once it's available, I check if it's not null. https://i.stack.imgur.com/xSAte.png <div class="MuiInputBase-root MuiInput-roo ...

When using a Map<k,v> to store key-value pairs, what is the best way to retrieve a result when the parameters are uncertain

Within my project, there exists a JSON file structured like so: { "table1": [], "table2": [{ "field1": "value1", "field2": "value2", "field3": "value3" }], "table3": [] } I proceeded to convert this into a JSONObject using JSON-Lib. I have al ...

Import a large JSON file into either a MySQL or Oracle database

My team at work is responsible for supplying files to other services. These files typically range in size from 5MB to 500MB. We are considering using JSON instead of XML, but I am concerned about how our customers will be able to upload these files into th ...

Upon pressing a link that opens a new tab, he notices that the buttons and fields are not visible

Here is my issue: When I click on a link that opens in a new tab, switch to the new tab, and try to click on a field to enter text, I encounter the following error message: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate eleme ...

Challenges Encountered While Transitioning from Struts 2.1 to 2.3.15.1

After finding a recent security vulnerability in Struts, I have decided to upgrade my web application to Struts 2.3.15.1. Although the Application is currently functioning properly, I am encountering this issue: Caused by: java.lang.NoSuchMethodError: com ...

Navigating to an iframe window within a single window on a Windows application

Initially, I attempted to use driver.switchTo().frame("framename"); but unfortunately it did not successfully switch to the desired frame. driver.switchTo().frame("xxx");/// Throws an {"status":7,"value":{"error ...

Sliding the slider using Selenium WebDriver, Java, and Firefox

I'm facing an issue with Selenium Webdriver (version 2.32.0) and Firefox (21.0) while trying to manipulate a slider. My Java code looks like this: private void selectGiftCardPrice() throws TestingException { try { WebElement slider = ...

The Distinction between withArray and putArray in Jackson JSON

While making updates to the JSON using JACKSON databind, I came across two methods - "withArray" and "putArray", but I can't seem to find any difference between them. Can someone please explain the distinction between these two methods? ((ObjectNode)root) ...

Ways to avoid running any cucumber-jvm scenarios if the initial scenario fails

I have 8 scenarios using cucumber-jvm, with the very first scenario focused on measuring page load time and checking environment availability. If this initial scenario fails, such as due to an unavailable environment or slow loading times, I want all other ...

Retrieving specific information from the Model and returning it as a JSON response using annotations

I am interested in receiving a JSON response with additional annotations. Currently, my JSON response looks like: { "id": 1, "startDate": [ 1993, 12, 12 ], "endDate": [ 2018, 11, 22 ], "totalDistance": 255, "totalPrice": 211 } How ...

`CSS Content Placeholder Issue When Used Alongside JavaScript`

Let me explain a bit, I have a master page named UserProfile.master which has a content placeholder linked to UserProfileWall.aspx. Now, I am trying to incorporate some additional JavaScript and a second CSS file in the userprofilewall page. However, whene ...

Are there any similar tools to Graphstream in Java that can be used with HTML5 using canvas and JavaScript?

GraphStream is a revolutionary graph library created in Java that offers Java developers a simple way to visually represent dynamic graphs either in memory, on screen, or in files. Check out this demo video. With GraphStream, you can effectively handle th ...

Gathering Servlet details from non-form elements

I am currently in the process of developing an application that is capable of parsing JSON strings. At this stage, I am able to input a JSON string using Java, write it to an HTML document, and then have a JavaScript program read and parse it before ultima ...

Struggling to concentrate on a recently opened Selenium window

Having trouble focusing on a new window using Selenium and Java while running my application on Internet Explorer. The new window opens but I'm unable to interact with it. I've tried the following code: Set<String> allwindows = driver.getWindowHandl ...

Retrieve the inner text value from the third child element of an HTML using Selenium in Java

Here is the HTML code snippet: <h2 id="xyz" class="test"> <button class="restore 1" value="test2" title="hello"> Line1 </button> <button class="restore 2" value="test3" title="click"> Line2 </button> I need this text &l ...

building a diverse language website on amazon web services

In our upcoming project, we aim to develop a multilingual website utilizing AngularJS and AWS. The website will feature dynamic data sourced from the back end. We are contemplating the best approach for handling language-specific content - should we store ...

How to Send Java Packets to a Python Server?

I have recently started learning about sending UDP packets and I am encountering a challenge. I have successfully established communication between a Java client and server, as well as a Python client/server combo. However, I am struggling to figure out ho ...

Searching for elements using Select Element

Struggling to execute this piece of code due to a null pointer error on the Select element... Check out the snippet of my code below: @FindBy(id="ddCompany") WebElement Select; public void Test(){ driver.findElement(By.id("igtxtdfUsername") ...

When you click on the bottom of the list, you access the element at the top of the list

Currently, for my test using Java and Selenium, I need to click on an element at the bottom of a list within the application. The code snippet I am using is as follows: wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='4']" ...

The application appears to be overloaded with tasks on its main thread, potentially causing errors

I am currently in the process of developing an app for user login and registration. The app relies on receiving a JSON response from a webservice to interact with the database. However, during the registration process, I encountered the following error mes ...

Spring Boot fails to recognize path variable data sent from Angular

When working with Angular 7, I encountered a situation where I needed to pass a value from the service class of Angular. Here is how I achieved it: executeHelloWorldBeanServiceWithPathVariable(name){ console.log("name coming from here"+name); retu ...

Trouble with clicking the button in Selenium Webdriver? Element located but unable to be clicked

Can anyone assist me in finding a solution to my current problem? I have dedicated a significant portion of today trying various solutions both on this platform and through Google. To get straight to the point, I am facing an issue with Selenium automatio ...

Obtaining the dynamic id with xpath in Selenium WebDriver

I am having trouble retrieving the id of an element that starts with 'u_' and ends with '_5', with varying data in between. Sometimes it appears as 'u_d_5' while other times it is 'u_6_5'. The usual methods like star ...

A guide to testing XSS vulnerability with Selenium WebDriver

I'm currently working on creating automated tests for my application. One test idea I have is to check for Cross-Site Scripting (XSS) vulnerabilities, specifically looking for script/markup injection. Let's say there's a field that takes text input: < ...

I need help transferring a Java Ajax response to my foreach loop

Using AJAX to Populate Dropdown with Dynamic Data <script> $(document).ready(function () { $('#selSclCatg').change(function () { var catId = $('#selSclCatg').val(); $.ajax({ ...

Guide for executing two @Test methods within a single class file by utilizing WebDriver and TestNG

As I delve into the world of Web Driver, I encountered a piece of code that sparked my curiosity. Within this code snippet, there are two @Test methods residing in a single class that I am eager to run in parallel using testng.xml. Alas, a nagging questio ...

Continuously retrieving information from a database to display on a web page

Our team is currently developing a solution that requires a dashboard with basic views and charts that need to be updated every 10 seconds when active. Each user will have the same charts but showing filtered information. In order to achieve this function ...

Discover the process for downloading a log file rather than opening it in Chrome when memory is below 200B, utilizing Selenium Remote WebDriver

In the code snippet below, we are attempting to capture information when a file is opened in Chrome. However, there have been instances where some log files fail to open and instead get downloaded, making them unviewable in Chrome. Please advise if any pr ...

Is there a way to delay script execution in Selenium web driver until the screen has been resized?

Encountering an issue with a specific part of my code: webDriver.manage().window().setSize(new Dimension(width,height)); TimeUnit.MILLISECONDS.sleep(100); webDriver.executeScript("window.scrollTo(0,document.body.scrollHeight);"); The challenge lies in en ...

Can a file be successfully retrieved using an HTTP POST request?

Can a file be downloaded using HTTP POST method? I am aware of the "Get" method (windows.location), but in my scenario, there are many parameters that need to be sent to the server. ...

What is the best way to save and load a level file that contains abstract objects?

I am currently developing a level editor that needs to include a save feature similar to Mario Maker. The goal is for users to create levels and save the corresponding data. However, I am facing some challenges. My level structure includes a list of Enemie ...

Error handling in Spring MVC's @ResponseBody annotation

I am encountering an issue with passing an entity GroupStudent object from my Spring Controller to a JSP page using an ajax function. When attempting to pass the GroupStudent object using @ResponseBody, I consistently receive an error in the browser: Error ...

Evaluating an AngularJS application using Selenium

Exploring the functionalities of an AngularJS application Discover more about Angular JS App Encountered an error while clicking on the UI Kit link on the website - Error at demoaj.Ajapp.main(Ajapp.java:16) Caused by: org.openqa.selenium.NoSuchEleme ...

Searching for elements within a Selenium WebElement: Tips and techniques

Currently, I am creating a collection of WebElements using this code: List<WebElement> elements = driver.findElements(By.className("name")); Now I want to access subelements within each element in elements. I have attempted solutions like WebElem ...

Modify the appearance of HTML dialog box using CSS styling

Currently, I am working on a Java Spring project that includes a single CSS file consisting of around 1500 rows. Recently, I was tasked with adding a dialog box to one of the screens in the project. The issue I encountered is that the style of the dialog b ...

When using Selenium, the moveToElement method does not properly click on the desired target in Internet Explorer but works correctly

While using Selenium to navigate a menu, I have encountered an issue specifically with IE where the submenu item becomes inaccessible as it ends up clicking on the menu below my target. This method works perfectly in Chrome but not in IE. // Actions not s ...

What is the best way to create a divider between tab panes in JavaFX?

I created a unique vertical tabpane, but I am struggling to insert horizontal lines between each label. Below is the code snippet I have used: .tab *.tab-label { -fx-rotate: 90; } .tab { -fx-padding: 3em 0.5em; } .tab-pane .tab-header-area .tab ...

The issue of Access-Control-Allow-Origin not functioning properly when using Ajax for a POST request

I am encountering an issue with the header "Access-control-allow-origin" when making a request using the following code: <script type='text/javascript'> function save() { $.ajax( { type: 'POST', ur ...

Converting a JSONObject to an Array in JavaScript

I am new to JSON and encountering an error while trying to fetch data: E/Volley: com.android.volley.ParseError: org.json.JSONException: Edit: Full StackTrace: 2020-11-10 20:06:48.606 10505-10505/com.madcoderz.jsonparsing E/Volley: com.android.volley.Pars ...

Learn how to extract Json values through the use of underscore (_) concatenation

Is there anyone who can assist me in extracting data in a JSON format like this: {"EMPLOYEE_DETAILS":"1-abc_xyz"} instead of the default format like {"id":1, "firstName":"abc", "lastName":"xyz"}? The data should be retrieved from a specific column. For i ...

Tips for saving error messages to a text file after Selenium WebDriver Java scripts fail:variables can be utilized to capture and store exception and error

Can anyone assist me with saving exception and error messages in a text file for only the failed scripts using TestNG, Jenkins, Java, and hybrid automation framework? Any help would be greatly appreciated. ...

What is causing the delay in retrieving elements using getX() method in Selenium?

Recently, I've been experimenting with web scraping using Selenium. However, I've noticed that there is a delay when calling getText(), getAttribute(), or getTagName() on the WebElements stored in an ArrayList from the website. The website I'm scraping ut ...

"Error encountered: java.lang.NoClassDefFoundError while attempting to execute a jar file using ant

Reaching out to the Selenium community in case anyone has encountered a similar issue while setting up selenium tests using Ant. I have tried multiple solutions posted on various forums, but I am still unable to resolve my issue. When I compile the code ( ...

The JSONObject contains a value, however it may sometimes return a null value

[ { "valve": "4679", "selling": "5516", "bal": "9075.4", "o id": "37", "invested": "11122", //<<<<<<<- this value returns null "aProfit": "1012", //<<<<<<<- this value returns null ...

What could be the reason behind the occurrence of Content-Length=0 for jQuery AJAX POST requests in the IE 11 browser without

I've been developing a Spring MVC based web application. Here are the details of my environment :- Java 1.8.0_162 (64 bit), Spring 4.3.1, Apache Tomcat 8.0.49, Waffle-1.8.3 for SSO, jquery-1.11.3 and Google Charts API. I have included the following JavaS ...

Collaborate and apply coding principles across both Android and web platforms

Currently, I am developing a web version for my Android app. Within the app, there are numerous utility files such as a class that formats strings in a specific manner. I am wondering if there is a way to write this functionality once and use it on both ...

Using Selenium and Java, there is no error generated when the selectByVisibleText method is used with incorrect option text

While attempting to locate an element using the selectByVisibleText() method within a dropdown, the program continues to execute even when the specified text is not present in the dropdown. However, upon completion of the program, an error is displayed. H ...

Guide on maintaining Spring Security authentication across Angular front-end

Following the initial feedback on my query, I made adjustments to my Spring Security setup and successfully logged in and accessed a test endpoint using Postman. However, when the same endpoint is called by Angular post successful login, the request fails, ...

Automatic scrolling feature in JavaFX

I am currently working on developing a chat box using JavaFX. My goal is to implement an auto-scroll feature that will scroll down the page when it gets filled up. However, I am facing some issues with this functionality. import javafx.application.Applica ...

Selenium 4 in Java: Tricks to Bypass Detection and Successfully Log into Gmail with Firefox - Troubleshooting the

I'm looking to streamline the login process for Gmail using Selenium 4, but I keep encountering the following message: Screenshot Is there a way to bypass this detection system? I've attempted all the available solutions online, but none have worked so f ...

Establishing the exterior façade prior to generating the Docker image

I am currently new to Docker and in the process of dockerizing some applications. The project structure consists of: -PlayProject -------app ----------controllers ----------models ----------views -------ci -------conf -------project -------public ---- ...

What is the best way to locate an element using xpath?

I've been on the hunt for a "button" to click, but unfortunately it doesn't have an id attached to it. No matter what I try - Xpath or cssSelector - nothing seems to work. Here are the elements of this elusive button: div style="cursor: grabbing ...

Initiate the process of displaying data on a datetime chart using Highcharts

I am currently developing a yearly chart, but I've encountered a small issue. The chart begins in January, however there is no data available until May. The client specifically wants the chart to only display when there is data available, and unfortu ...

Organizing JSON data with keys in Android Studio using Java

As someone who is new to java and android development, I am currently focusing on learning json parsing. Recently, I received a json response that looks like this: {"code":"0","data": [ {"chrDesigName":"Developer","chrempName":"Test Employee1"}, {"c ...

Embracing the node mindset with a Java foundation

As a Java Developer, I have become accustomed to working in a sequential manner where tasks are executed one after the other or concurrently with multiple threads. The organization of code in a sequential way seemed logical under this paradigm. However, wh ...

Creating a Test Data List for Selenium functional testing with JAVA

I am currently in the process of setting up test data to validate the text displayed using selenium. I am facing an issue on how to effectively verify content with selenium. Can you offer some suggestions on how to accomplish this and how to structure th ...

Having difficulty selecting an element using XPath based on its title

https://i.stack.imgur.com/Of29v.png My XPath: ((//span[text()='Number of Allowances'])/../../../following::div//table[@class='mainTable']//tr[1]//input[@data-automation-id="numericInput"]) The XPath above clearly specifies that the aim is to select a tex ...

Automating the process of locating web elements for Selenium using code

My Journey with Selenium As a newcomer to Selenium, I am eager to learn and explore its capabilities in order to potentially take on testing projects at my company. After conducting research, I discovered that one of the main challenges for web testers us ...

Error in Android Gradle build: DuplicateFileException encountered when copying files into APK for com/fasterxml/jackson/core/json/VERSION.txt

After researching similar cases on stackoverflow, I found that the proposed solutions are very specific and heavily reliant on the combination of dependencies declared in the gradle file. Although I managed to build successfully, running the App resulted ...