Currently, I have a Tamper-monkey script in place that is designed to scrape specific text from a single page. The script's job is to extract the values of three buttons named pick_0, pick_1, and pick_2 from the page and display them in a designated box further down on the same page. Although the process is slightly more intricate than described, my primary goal right now is to ensure that it can successfully retrieve these values.
The major issue I am facing is that the script has been unable to capture the values accurately. I'm uncertain whether this discrepancy is due to how it's accessing the element or how it's interacting with the page itself.
On every resource I consult for a solution, the addition of ".value" to the code is always recommended to rectify the problem. Despite implementing this fix, I've reached a standstill which has led me to seek help through this inquiry.
A colleague shared the webpage scraping code with me, causing some concern as to its effectiveness. I've also experimented with alternative solutions sourced from Stack Overflow without any success thus far. It's worth mentioning that the TamperMonkey script is configured to execute exclusively on the specific page requiring scraping, although this detail wasn't explicitly mentioned within the script itself.
function getLink(url) {
return $.ajax(
{
type: 'GET',
async: true,
url: url,
});
}
Here are the variables I am working with:
function inputs() {
var pick_0b = document.getElementById('pick_0').value;
var pick_1b = document.getElementById('pick_1').value;
var pick_2b = document.getElementById('pick_2').value;
}
The functionality responsible for displaying the extracted data is functioning correctly when tested with a dummy variable exhibiting similar syntax. However, whenever I try to output the values from the aforementioned buttons, I only receive one of these two results:
undefined
[object HTMLInputElement]
Seeking assistance in resolving this matter. Edit: Below is the HTML markup for the buttons:
<tr><td class="centered"><input type="submit" name="pick_0" value="longass string of randomized text here" class="button" id="pick_0" /></td></tr>
<tr><td class="centered"><input type="submit" name="pick_1" value="longass string of secondary random text here" class="button" id="pick_1" /></td></tr>
<tr><td class="centered"><input type="submit" name="pick_2" value="longass third string of random text here" class="button" id="pick_2" /></td></tr>