Having trouble populating the current date into a web form using Selenium, by retrieving it from an Excel sheet

I already know how to retrieve the current date, but now I need to set it as the previous day's date.

My biggest challenge is figuring out how to input this yesterday's date into a web form using Selenium. The form requires information such as surname, forename, DOB, and medical report (where the date needs to be in ddMMyyyy format) which are all read from an Excel file.

Answer №1

If you need to retrieve yesterday's date in Java with the format ddMMyyyy, you can use the following code snippet:

DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
System.out.println(dateFormat.format(cal.getTime()));

I hope this solution is helpful for you. Please let me know if it works as expected.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Troubleshooting Python Selenium Code: Identifying and Correcting Errors

Can someone explain why this snippet of code opens Mozilla twice and doesn't close it after finishing? I'm also a bit confused as to why the login function is within a class instead of being a standalone function. > import unittest from selen ...

Launch two instances of Chrome in remote debugging mode and establish a connection to Selenium

My challenge is managing two separate Chrome drivers in remote debugging mode simultaneously using Python on Windows 10. The process goes smoothly when I launch the first browser through the terminal with chrome.exe –remote-debugging-port=9222 –user-da ...

Proceed with the next step in Selenium Python if the element cannot be located

Here is a script that automates Instagram page navigation: browser = webdriver.Chrome('./chromedriver') # Navigate to Instagram login page browser.get('https://www.instagram.com/accounts/login/?hl=it') sleep(2) # Enter username and ...

tips for passing value to the date field using proctractor

This is the HTML code I am working with: <input id="filter-datepicker" type="daterange" ranges="ranges" class="form-control date-picker" placeholder="Select Date Range" name="sensorDetails.date" ng-model="myDateRange" ranges="ranges" requi ...

Encountering an ElementNotInteractableException with Selenium while attempting to interact with the autoComplete text box

I am encountering an issue with the WebElement that I am trying to interact with on a certain Webpage. Despite using the code below, I continue to face the mentioned error. This element is capable of enabling subject autocompletion and allows for multiple ...

The error "Missing ; before statement" occurs when using the waitForCondition function

After reviewing all the examples, I am still struggling with the use of waitForCondition. Below is the code that is causing me trouble: WebDriverBackedSelenium seleniumWD = new WebDriverBackedSelenium(driver, "http://www.x.com"); seleniumWD.waitForCondit ...

When using RF and Selenium, Google Chrome was not the browser that was chosen to run

Currently, I am testing my scripts using Robot Framework version 2.7 with Selenium version 2.18. The challenge I am facing is running the tests in three different browsers: Firefox 9, Internet Explorer 8, and Google Chrome. Interestingly, when executing th ...

Python Selenium code encounters a "TypeError: this.each is not a function" issue

Currently, I am attempting to extract quotes from Goodreads using a scraping method. The code snippet in question is as follows: from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import Chro ...

Discovering elements by class name using Selenium in web scraping

I am attempting to scrape all of the product data from this webpage: https://www.shufersal.co.il/online/he/קטגוריות/סופרמרקט/חטיפים%2C-מתוקים-ודגני-בוקר/c/A25 I am aiming to extract all the li tags with the class name ...

Implementing Allure command in Java: A step-by-step guide

Is there a way to automatically save test case wise reports in their respective folders? For example, when running the login test case, can the allure html report be saved in /reports/login? Currently, I manually execute the command below once my test exe ...

Unable to extract specific dates from a table in a customized way

I have successfully utilized a Python script with Selenium to extract dates from a table on a webpage. The specific table, NPL Victoria Betting Odds, contains data within the id tournamentTable. Within this table, I have identified three dates: 10 Aug 2018 ...

Having trouble executing Selenium + Python Script on Linux Mint with Chrome and Firefox browsers

I'm encountering challenges when trying to execute a Python (3.5) + Selenium (3.4.0) script on Linux Mint 18.1 Serena with Chrome and Firefox. Here are the details: When attempting to run the script below for Chrome or Firefox browser, I am facing i ...

There was an error stating "No element found: Could not find element using method 'css selector' and selector '.contact-button link-phone' in Python's Selenium."

I'm currently working on a project where I need to extract information from a website and then use it for another purpose. To achieve this, I am using Selenium with Python. Here is what I have accomplished so far: from selenium import webdriver from ...

Leveraging the Meteor Framework for Application Monitoring

Exploring the potential of utilizing Meteor Framework in a Monitoring Application. Scenario: A Java Application operating within a cluster produces data, which is then visualized by a Web Application (charts, etc.) Currently, this process involves using ...

Is ChromeDriver now capturing empty screenshots?

My automated browser tests using ChromeDriver suddenly stopped working today. Upon checking the screenshots saved in the database, I discovered that they all appear as blank pixels. Why is this happening? Version ChromeDriver 2.29.0 Screenshot https:/ ...

Generating an object of a class using parsed attribute values from a CSV file (or potentially utilizing a different method?)

In my project, I have a MyClass that consists of 11 "normal" String attributes. The 12th attribute is a list of type OtherClass, which has two attributes: one string and one integer. public class MyClass extends BaseEntity private String string1; ...

Transforming JSON data into a visually appealing pie chart using highcharts

I'm having trouble loading my JSON string output into a highcharts pie chart category. The chart is not displaying properly. Here is the JSON string I am working with: var json = {"{\"name\":\"BillToMobile\"}":{"y":2.35},"{\ ...

What steps do I need to take to configure a grunt task that will automatically start my express server?

I'm searching for a simpler solution than using grunt-express, which seems to take over too many options and assumptions. All I really need is the ability to run coffee server.coffee from Grunt and have it continue running until another process stops ...

Extracting the text specifically from the child element in Webdriver using Java

I need to extract the GMT text from a child element. Here's an example: <strong class="EnvMain"> <strong id="currentClock">11:19</strong> GMT </strong> My goal is to retrieve only the GMT text. I attempted to use xpath l ...

Having trouble with importing "org.openqa.selenium.chrome.ChromeDriver" on MacOS

While working on my Java program for Selenium, I encountered an error when attempting to import "org.openqa.selenium.chrome.ChromeDriver" on my MacBook. The error message displayed was "The import org.openqa cannot be resolved". import org.openqa.seleni ...