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.

Gson: Omitting a field in a specific class without the use of annotations - Part 2

Currently I am working on serializing a Java object to JSON using Gson. My goal is to exclude a specific field in one class while keeping it in another. Here's a snippet of the code: Class A { var a; var b; } Class B { var a; var c; } Class C { ...

How can I properly retrieve an entry for processing within my route?

Hello everyone! This is my first question on this platform, so please bear with me if I'm missing any important details. I'll add them as soon as possible. I am currently working on setting up a camel route where I retrieve a URL from my Database and send ...

The Struts2 JSON response received through the $.getJSON method is showing an unexpected undefined result

Attempting to retrieve a String value from an action class using the $.getJSON method, but receiving an output of undefined. Below are the code snippets that have been tested: Script: $(function() { $("#newPostionFormID").submit( ...

Having trouble locating an element with text while scrolling on an Android emulator

I am currently using Appium desktop server version 1.15, java-client version 7.3.0, and selenium-server version 3.141.59. While working on my android emulator, I encountered a situation where I needed to scroll down to view a specific text and then stop t ...

Decoding JSON using JavaScript

I am dealing with a webservice that uses RestEasy to return a JSON object with a List element. When I try to parse the results in a JavaScript loop, everything works fine if there are two or more elements in the List. However, if there is only one element, ...

I encountered a Null Pointer Exception while trying to retrieve information from the Excel spreadsheet

Code: public class ContactFormTest { WebDriver driver; @BeforeMethod public void setUp() { System.setProperty("webdriver.chrome.driver", "Driver Path"); driver=new ChromeDriver(); driver.get("URL"); driver.manage().deleteAllCookies(); driver.manage().wind ...

WebDriver in Java fails to click the "Sign In" button on Yahoo Mail

Currently, I am using Selenium WebDriver (also known as Selenium 2) in conjunction with Java. In an attempt to click the "Sign In" button on Yahoo mail, I have crafted the code below: driver.findElement(By.id(".save")).click(); Regrettably, this code is ...

Find the Xpath to locate the image source on the Flipkart website

Looking for the XPath to click on an image in the mobiles section of Flipkart's website, specifically the realme shop. I have identified the necessary XPath and prepared the code as follows: package Test; import org.openqa.selenium.By; impo ...

Choosing Selenium Web Elements

Currently, I am working with Selenium and encountering an issue with one of the Xpaths in relation to creating a Gmail account. The problem lies with selecting the birth month option on the page. The Xpath I have provided below appears to be correct when e ...

Maximize Efficiency: Running TestNG Tests Concurrently With XML and Priority Settings

In my current situation, there is a requirement for a class labeled as "Pre-Requisite" to be executed initially. Following that, I have 5 TestNG classes which need to utilize specific data gathered from the "Pre-Requisite.java" class and then run all 5 cla ...

Selenium for uploading a file on a Mac device

I am facing a challenge when trying to upload a file on my MAC using selenium with Java. The button I need to interact with does not have an input tag, so I attempted to use robot script and even apple script but haven't been successful. Is there anyone wh ...

Tips for improving page parsing speed in Selenium

Is there a more efficient way to handle multiple parsing requests in Selenium when loading a page, rather than making individual http requests for each element? Can I convert the source code obtained from driver.getPageSource() into an HTML object to st ...

I'm experiencing an issue where the video from my server is not being displayed within the <video> tag in the browser, but when using the web URL, the video plays

When it comes to uploading a video, there are two options available: 1) Provide the web URL for the video, 2) Upload the actual video file. The <video> tag works smoothly with a web URL as the source, but issues may arise when trying to play an uplo ...

Ways to obtain the final day of the previous month

Attempting to utilize automated bots here, I am in need of retrieving the last day of the previous month. The bot performs accurately on the current month during the first run; however, when transitioning to the next month, the date retrieved from this cod ...

Issue with clicking the OK button in Selenium WebDriver using Java due to the presence of a span tag within the button tag

This is the HTML code snippet that I am working with: <div id="sieb-ui-popup-mvg-selected" class="AppletStylePopup"> <form onsubmit="return false;" action="/ecom_enu/start.swe" method="post" name="SWEForm4_0"> <div class="siebui ...

Is there a compilation of Selenium 2.0 add-ons available?

Currently tackling an automated testing project with Selenium 2.0 and finding the API to be quite low-level. Interested in refactoring common tasks like form handling to avoid repetitive code. Experienced difficulty locating a collection of contributed c ...

Link Karate to Selenium

Is it possible to integrate karate and selenium for my testing needs? I have followed instructions on how to call the "JavaApiTest class" and added the necessary karate-core dependency. However, when I attempt to run my tests using the cucumber runner, I e ...

Upon starting Selenium webdriver, Chrome browser displays a blank page

While trying to run a Selenium test script on the Chrome browser, I encountered some problems. When Selenium tries to launch the Chrome browser, it opens up with a blank page and I also received a pop-up message saying that chromedriver.exe has stopped wor ...

Encountering a problem when trying to find an element with xpath in Selenium 3

I am encountering an issue while attempting to click on a link that resembles a tab button using Xpath. Here is the snippet of html: <div id="tile_8" style="height: 93px; width: 26%; background-color: rgb(45, 87, 19); color: white; position: relativ ...

Develop an array of JSON Objects within a Java environment

My task involves handling a CSV file with 10 columns and multiple rows. The goal is to convert each row into a JSON object. An example of the file structure is as follows: Name, Age, Address..........and other columns ABCD, 23 , HOME.............and other ...

Developing org.w3c.dom.Node implementations specifically tailored for handling JSON data

I am in search of a way to utilize org.w3c.dom.Node for data types other than XML, such as json or avro. With this implementation, I can make use of functions designed for org.w3c.dom.Node, like xpath. org.w3c.dom.Node document = new JsonDocument(myJsonMe ...

What is preventing https://username:[email protected] from functioning properly?

I am encountering an issue with logging into a website that displays a popup asking for my username and password as soon as I land on the site. Even though I have tried using https://username:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" d ...

Regular Expression for valid Mobile Phone Number country code starting with 0092 or +92

Have you come across a standardized regular expression that captures all valid mobile phone numbers, such as 00923465655239 or +923005483426? I've been searching for it for two days but haven't found an expression that fits these formats. The co ...

Tips for saving a selected dropdown value to a variable in Selenium

As an illustration, consider the following Java code snippet for Selenium automated testing. In this code, I am extracting the value 9 from a static dropdown using the findElement method. The question now is: How can I save this extracted value in a vari ...

Fetching JSON data from a script tag in Java: What is the best way?

My objective is to extract the JSON value from a script tag on a webpage. The challenge lies in the fact that the JavaScript tag contains numerous functions alongside a JSON array. I have managed to convert the entire script into string format using jsoup, ...

Using either Java or Groovy, iterate through a hashmap and showcase an HTML table within a Velocity template

Just a heads up: Some users may have trouble reading code comments. For the record, this is not related to any homework assignment. I'm attempting to combine HTML and a hashmap for the first time. Despite searching for explanations online, nothing see ...

Capacitor: Building without push-notifications plugin is not possible

I have been attempting to utilize the capacitor push notifications plugin in a quasar project. I followed this tutorial as a guide. However, upon running the command: quasar build -m capacitor -T android, I encountered this error within my quasar project: ...

Unable to retrieve the value from an "input" element

Currently, I am utilizing Selenium with Java to create a test. My task involves retrieving the text from inside an input element: <table class="boundaryFormAdd"> <tbody> <tr> <td> <input id="id ...

Is it possible to create a mapping for the jsonProperty of nested fields in an object?

In my project, I have created two classes named Car.java and Bus.java. Car.java private Property property; Bus.java private Property property; The Property.java class contains attributes for number and colour. ...

The compilation of debug Java with Javac in CordovaLib is not being done incrementally

I am currently in the process of setting up Ionic on my new computer, but I have encountered an issue while trying to build a Cordova Android project that I can't seem to resolve. The software and versions I am using include: NodeJS v6.9.1 npm ...

Retrieving text from a collection of Web Elements can be time-consuming

I have written a code to extract data from a web table, where each row is read as text and added to another list before being sent to a method for writing to an excel file. However, this process of reading approximately 200 rows and writing the data to a n ...

Encountering a geb.driver.DriverCreationException while executing a Jenkins automation task using Selenium with Groovy on a LINUX machine

Encountering a geb.driver.DriverCreationException error while running a Jenkins automation job with Selenium and Groovy on a LINUX computer. Working on an Automation script using selenium with Groovy. Here are the environment details: java version = 1.8.0 ...

The Java Selenium ChromeDriver experiences delays when loading a new page

I am currently working on a script that automates the login process on a website and performs certain actions. The code for logging in is as follows: WebDriver driver; JavascriptExecutor exec; String dni = "..."; String passwd = "..."; ...

Errors in Selenium Webdriver - troubleshooting the issues

As I delve into the world of test automation, I decided to try my hand at writing a script using Selenium Webdriver. To my dismay, upon running the script, I encountered a barrage of errors that have left me scratching my head in confusion. Despite metic ...

Experiencing receiving a null value for an XML-formatted string following the process of

I am new to android development and I am currently working on a project where I need to call a webservice that returns a JSON string as a response. This JSON string contains an XML formatted string as one of the entries. String jsoncontent=restTemplate.ge ...

Learn how to extract a specific field from a String containing JSON data using Gson or another Java library

I have a String that contains JSON formatted information, specifically an OAuth token. How can I extract the refresh_token? This is the JSON data printed from the inputLine: { { "access_token":"ffa6ea48612b19966383fd6b134fe2c4daac80ce31a8632284b ...

The data represented as a JSON Map<String,ArrayList> is having trouble being converted into a bean object within Jersey's rest

Currently, I am facing an issue with retrieving Map values in my Ajax call with JSON data of String, Array and Map. While I am able to successfully get String and Array data by converting them into the Bean class DashboardChartData in Jersey, I am encounte ...

Issues with Ajax requests in Java Server Faces are causing functionality to not perform as expected

Utilizing the OpenFaces library, I am trying to trigger an ajax request when a checkbox is checked in order to display a TextArea. However, this functionality does not seem to be working as expected. The approach I am using mirrors that of the JSF standard ...

What is causing my page to refresh when making an Ajax call? (e.g. triggering the servlet request again

I'm currently learning about RESTful web service implementation using Java in my development environment, which consists of Netbeans IDE with GlassFish v3. Within my project, I have a specific page URL called /inventoryList, which is mapped to the Invento ...

Issue with Selenium Webdriver: Difficulty in selecting a value from dropdown even though the value is present

Currently I am conducting web site testing using Selenium. While working with the dropdowns on the site, I have encountered an issue with one particular dropdown. Manual clicking on the dropdown reveals multiple options, however, when I try to access the e ...

Instructions on making a Java JSON DTO for arrays or lists without specifying item names

I am attempting to read input JSON from a controller When I use the name in the node, everything works fine This is the JSON data: { "itemList": [ { "name": "Alex", "surname": "Ivanov", "age": "25" ...

"Step-by-step guide on setting up Selenium with Java on a fresh system and implementing Jenkins as a continuous integration (CI) tool for

Embarking on Automation in my current project, I am looking to implement Selenium for Test Automation using Java. With Jenkins (formerly known as Hudson), I aim to generate accurate Test Reports. Could you guide me through the installation and configuratio ...

To choose an item from the context menu with Selenium, typing in sendKeys isn't effective

When attempting to select an option from a context menu, using sendKeys(Keys.ARROW_DOWN) has not been effective. Instead of navigating the context menu, it simply scrolls the page up and down, leaving the menu open. Actions action = new Actions(driver); a ...

A step-by-step guide on fetching multiple iframe contents simultaneously with Selenium in Java

Today, I am facing an interesting challenge. I need to extract the page source of a webpage that includes an iframe. Surprisingly, when using the PhantomJSDriver with the code snippet below, I am only able to retrieve either the page content or the iframe ...

Concentrate on the current open tab with the help of Selenium WebDriver

I have encountered an issue on my website where clicking a button opens a new tab with a link in the same browser. Now, I am seeking a way to instruct selenium to focus on that newly opened tab. I have experimented with multiple methods but so far none h ...

What is the best way to click in Selenium while dealing with autoplay videos?

Currently, I am working on a Java code in Eclipse that involves using Selenium to find and download Instagram Stories of a user onto my computer. While I have successfully been able to download all the photos from the stories window, I have encountered sev ...

Converting JSON to XML in Java while preserving attributes

When utilizing the org.json json library, converting from XML to JSON is straightforward. However, the conversion back to XML results in JSON attributes being converted into XML nodes: import org.json.JSONObject; import org.json.XML; public class Test { ...

What is the best method to extract a specific value from a JSON object?

I have parsed a JSON file to extract data such as "Floor", "flat_no", and "Flat_id". Here is an example of the JSON structure: { "results": [ { "Flat_id": "1", "cat": "2", "Flat_no": "101", "Floor": "1", "Flat_t ...

Unable to parse JSON file

In this code snippet, I have implemented a method for reading data from a JSON file. private void LoadTabaksFromJson() { InputStream raw = mContext.getResources().openRawResource(R.raw.tabaks); Reader reader = new BufferedReader(new InputStreamRe ...

Is there a way to retrieve the parent id from HTML code when using Selenium WebDriver with Java?

Is it possible to retrieve the parent ID in the provided HTML code using the class name "description"? All div elements have a common class name of "card-box" and their IDs are generated during runtime. <div id="2321-79" class="card-box"></div> ...

Steps to retrieve text associated with a checkbox: Simply select the checkbox to mark it and then view the corresponding text displayed alongside the checkbox

I have attempted to use this code but unfortunately it is not functioning properly. Instead, it is displaying a null value. String ServiceName = SitePackageScript.driver.findElement(By.xpath("xxxxxx")).getAttribute("Value"); The HTML <tr> ...

Obtain some content using Java along with Selenium WebDriver

I only want to extract the text "Invitation sent to xxxxx". I do not need the content inside the button tag. <button class="action" data-ember-action="" data-ember-action-3995="3995"> Visualizar profile </button> This is how I am c ...

What is the best method to ensure that Selenium WebDriver waits for an AJAX load to complete before proceeding with any

Is there a way to ensure that Selenium WebDriver waits for an Ajax load before proceeding with any activities? I am automating the process of filling out a form using my script, where I click on a button that opens a new form with some fields prepopulated ...

Running tests using Selenium and Maven works fine on a local machine, but encounters an issue in Azure Pipeline with the error message "unable to access org.testng.Assert."

Running TestNG or Maven tests locally shows that all test cases are working correctly. However, when running the tests in a pipeline, an error is encountered stating "cannot access org.testng.Assert". Attached below are error screenshots of Azure Pipeline: ...

What is the best way to convert a JSON string received from Angular into a Java Object within a Spring

I am currently utilizing WebSocket to create a chat application. Below is the code from my Angular application that sends a MessageModel object to the backend after converting it into a JSON string: sendMessage(message: MessageModel){ let data = JSON.str ...

When attempting to call methods after executing a new Class in Android Studio, the application crashes

I have been working on an app that utilizes JSON data. The issue I am facing is that when I retrieve the JSON using HentData.execute() and assign it to a string variable, my program crashes when I try to perform any operations with it. HentData extends As ...

Unlock hidden messages by deciphering the Ascii string values within a lua file that has been

After decompiling a lua file using unluac, I discovered that all the string variables are no longer readable and are now ascii encoded clues = { { answer = { "\216\173", "\216\177", "\216\168", " ...

Attempting to display an error notification

I am having trouble displaying an error message on the webpage. The error message reads as follows: ERROR Your request has not been successful. You need to contact Customer Care to arrange a replacement. Within the error message above, there is a lin ...

Can anybody provide information on clearing the CACHE Memory of a browser programmatically with Selenium WebDriver?

Is there a way to clear the browser's CACHE Memory without having to delete Cookies and risk logging out of my account? ...

The JsonDeserializationException encountered an error while attempting to deserialize the object

When receiving data from the BackEnd, it typically looks like this: {name : String, author : String, updater : String, media : String, } Sometimes, the 'media' field can also be an array with a different structure, but unfortunately I am unable to mod ...

I'm attempting to showcase information from my MySQL database in JSON format, but I'm consistently encountering the same error message

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myexample/com.example.myexample.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object refe ...

Transferring an Excel file through an HTML form input to a Java REST method

How can I submit an excel file from an HTML form input field and send it to a RESTful Java method for processing? I am integrating AngularJS into my project as well. ...

Accessing data in a JSON file can be done by

Similar Question: Reading a Json Array in android I am attempting to extract the field names from a string using JSON. While I have successfully retrieved the values, I am struggling to retrieve the field names. Here is an example: String strjson: { ...

The GWT plugin seems to be missing when using chromedriver

Trying to run Selenium tests on a GWT Java application and utilizing the ChromeDriver for this purpose. Requiring the GWT Plugin in the settings, here's the process I follow: @Provides @Singleton protected WebDriver getDefaultWebDriver() throws IOEx ...

Dealing with null object values during Jackson parsing

I am currently utilizing the Jackson library and attempting to accomplish a task as described here BaseOperationRequest.java @JsonTypeInfo( use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "command" ) @JsonSubTypes({ ...

Difficulty with locating elements that are not easily identifiable using standard methods like xpath, id, or class

Identify the 3rd td in tr with a class that includes "zebra" The image displays my current task. I am required to pick out the quantity corresponding to each of the 4 animals, which is always found in the 3rd td of the tr element. In the provided html, yo ...

Communication between the Node development server and the Spring Boot application was hindered by a Cross-Origin Request

Here is the breakdown of my current setup: Backend: Utilizing Spring Boot (Java) with an endpoint at :8088 Frontend: Running Vue on a Node development server exposed at :8080 On the frontend, I have reconfigured axios in a file named http-common.js to s ...

Steps for logging into a Google account using Selenium1. Open the browser

I attempted to access my Google account using Selenium and encountered a roadblock. From what I understand, there are some settings that need to be configured for this task. I have already attempted the following: View But unfortunately, it did not provi ...

Retrieving information from an Open Office spreadsheet using Selenium and Java

Can Open Office spreadsheet (ODS) files be utilized for reading and writing data in Selenium with Java? I have conducted a thorough search online but have not been able to find any solutions. Any assistance would be greatly appreciated. ...

Generating JSON document by utilizing a foreach loop

I have been attempting to retrieve data from a database and then set the values in a JSON document using an ArrayList. However, I am facing challenges in doing so. Consider this hardcoded JSON that I aim to convert into dynamic JSON. String json = "{ &bso ...

how to transfer data from backend servlet to frontend javascript

Hey, I'm still learning about servlets so please excuse any confusion in my message! So basically, I'm trying to figure out how to pass a value from a servlet to JavaScript or even retrieve values from a servlet method within JavaScript. But I'm not entire ...

Struggling to extract the text from a list within a <ul> tag, but it seems to be grabbing only the initial item

Here is the structure of an unordered list View the structure of the unordered list I am attempting to extract the values of "var" and "time" as strings and store them in an ArrayList List<String[]> finalResult = new ArrayList<>(); This is w ...

Implementation of Logical name for Selenium WebElement

Is there a known implementation or pattern for retrieving the "Logical Name" of a Selenium WebElement object in Java? I am interested in something along these lines: @FindBy(xpath = "//tr[2]/td[@class='listrow1'][3]") private WebElement txt ...

Obtaining a distinct movie identification (tmdb API) utilizing '@PathParam'

I recently started working on my first spring boot project, but I feel like I still have a lot to learn. Despite searching on Stack Overflow and Googling for answers, I haven't found a solution yet. It would be greatly appreciated if someone could provide ...

Retrieve all search results displayed on the Google search results page

I need assistance in using Selenium to retrieve search results from Google after entering a specific query. Currently, I have created the following code: WebDriver driver = new ChromeDriver(); driver.get("http://www.google.com/xhtml"); Thr ...