I have an automation problem that I am trying to solve. The task involves accessing a specific webpage with two editable text fields and some other elements, extracting the content from these text fields using a Java program to filter keywords and generate a string. Ideally, I would like to then post this string back into one of the text fields on the webpage. However, the page is password-protected, and I need to log in to access it. Additionally, my expertise lies mainly in Java, so I prefer to write the filter in that language.
My initial attempt involved using the URL class in Java to read the source code of the webpage, looking for the content of the text fields to filter. Unfortunately, I was unable to connect to the page due to the password protection. I then considered creating a Mozilla Firefox add-on to retrieve the page's source code using "document.documentElement.innerHTML" and pass it to my Java program or store it temporarily for processing. However, I could not find a suitable command to achieve this.
To proceed, I require a solution to send the password to access the restricted webpage and extract the content of the text fields through an alternative method (such as obtaining the source code of the page). Finally, I need a seamless way to submit my filtered string back to the website.
Any assistance you can provide would be greatly appreciated. Thank you for understanding my situation and offering a possible solution.
public static void main(String[] args) {
// Java code snippet
}
// Simple Addon still
exports.main = function() {};
require("widget").Widget({
id: "widgetID1",
label: "My Mozilla Widget", //to be changed
contentURL: "http://www.mozilla.org/favicon.ico" // To be changed
onClick: function(event) {
// Javascript code snippet
}
});