When I do.
I receive as the screenshot attached.
But I need one array having each array as a whole number.
'use strict'
const { helper, browserstackBase } = require('@core/IQAir')
const webdriver = require('selenium-webdriver')
const { initializeBrowser } = require('@core/IQAir/Automation-Library/library')
class USaqMajorCityRankingTable extends browserstackBase {
async execute(driver) {
await driver.get('www.iqair.com/us/world-air-quality')
await driver.sleep(2000)
await initializeBrowser(driver)
await driver.sleep(2000)
const aqiData = await driver.findElements(webdriver.By.xpath("//table[@class = 'ranking__table ng-star-inserted']//td/p"));
await helper.sleep(2000);
await helper.sleep(2000);
for (const aqi of aqiData){
await helper.sleep(2000);
const a = await aqi.getText()
const promise1= Promise.resolve(a)
promise1.then((value) => {
});
}
}
}
module.exports = new USaqMajorCityRankingTable().runTest()
for (const aqi of aqiData){
const a = await aqi.getText()
const promise1= Promise.resolve(a)
promise1.then((value) => {
const flattened = [].concat(...value);
console.log (flattened)
Can Anyone please help!! enter image description here
I am confused if it is a 2D array, because, if I want to return [0][0] or [0][1]
I receive an error:
"cannot read properties of undefined (reading '0')"
aqi.getText()
returns? does it returns a comma seperating string containing multiple numbers or what?