D
D
Danil Samusev2021-09-21 16:27:35
Node.js
Danil Samusev, 2021-09-21 16:27:35

Why can't Selenium find the element?

It doesn't give an error in the code, but it doesn't react to the click, the element is within the frame. I changed the code as best I could. I went through the whole stack and habr, nothing works. I didn’t figure out how to copy the HTML code, I kind of copy it, but at a rate it’s generally different. I won’t be able to send a link to the site with him, because the question was deleted twice because of this.

await driver.switchTo().frame(1);
  var element = await driver.findElement(By.xpath('/html/body/div/div/header/div[18]/div[3]/div'));
  console.log(element);
  await element.click();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question