I have simple code which stopped print value and return this instead. Any clue what’s wrong?
My code:
async function openWiki() {
let driver = await new Builder().forBrowser("chrome").build();
await driver.get("https://cs.wikipedia.org/wiki/Special:random");
let title = await driver.findElement(By.id("firstHeading"));
console.log(title);
}
openWiki();
end it wrote to terminal:
WebElement {
driver_: Driver {
session_: Promise { [Session] },
executor_: Executor { customCommands_: [Map], log_: [Logger], w3c: true },
fileDetector_: null,
onQuit_: [Function: onQuit],
authenticatorId_: null,
pinnedScripts_: {}
},
id_: Promise { '50117978-c479-43d4-aced-033f6b2799fc' }
}
I expect value written to the console. When only returning title, there is no error. I tried title.getText(), I got Promise { <pending> }