I'm trying to fetch the number out the Steam site ->
Code trials:
await driver.findElement(By.xpath("//div[@class='online_stats']//div[2][@class='online_stat']")).getText().then((text)=>{
onlinePlayersInGames = text;
});
Doing it with this code results in me getting a returned value of:
ONLINE
22,099,967
Rather than only fetching the number.
CodePudding user response:
To extract the data for playing now:
await driver.findElement(By.xpath("//div[@class='online_stat'][./div[@class='online_stat_label gamers_in_game']]")).getText().then((text)=>{
onlinePlayersInGames = text;
});
To extract the data for online:
await driver.findElement(By.xpath("//div[@class='online_stat'][./div[@class='online_stat_label gamers_online']]")).getText().then((text)=>{
onlinePlayersInGames = text;
});