apache / apache/cordova-plugin-inappbrowser
Can't Retrieve HTMLCollection Object
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
Im trying to accessing the data inside of HTMLCollection.
## Problem
I cant accessing it, and retrieve the data.
### What is expected to happen?
it should return the data inside the HTMLCollection
### What does actually happen?
It always gives null.
## Information
this is the result of the print

### Command or Code
`InAppBrowserRef.executeScript({
code: `
console.log('masuk di script');
window.addEventListener('DOMContentLoaded', function () {
console.log('Im here 1');
});
document.addEventListener('DOMContentLoaded', function () {
console.log('Im here 2');
});
window.addEventListener('load', function () {
console.log('Im here 3');
});
document.addEventListener('load', function () {
console.log('Im here 4');
});
const elements = document.querySelectorAll(".text-grey");
console.log('this is elements', elements);
console.log('this is the lengthnya', elements.length);
console.log('trying to open the 0 index', elements.item(0));
const newArray = Array.from(elements);
console.log('this is the new Array', newArray);
newArray.forEach(function (element) {
console.log('result of forEach', element);
});
Array.from(elements).forEach((element) => {
console.log(element.innerText)
});
`
},
function (result) {
console.log('Script Executed:', result)
})
}`
### Environment, Platform, Device
Samsung A50s Android 11
### Version information
Operating System - Windows_NT(10.0.22631) - win32/x64
NodeJs - 16.20.1
Global packages
NPM - 8.19.4
yarn - 1.22.19
@quasar/cli - 1.3.2
cordova - 12.0.0 (cordova-lib@12.0.1)
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start with the InAppBrowserRef.executeScript call and its callback on Android 11, then isolate whether the .text-grey elements are available when the script runs. Done means a minimal reproduction establishes the cause and the behavior is either clarified for users or corrected with verified results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100