Dali Hamzaoui
Dali Hamzaoui

Reputation: 41

code works fine in javascript but not in selenium

when i execute

"document.getElementsByClassName("jobs-company-card__cta-link ember-view");"

in the console (javascript) it returns the elements by that class name but when i execute :

driver.findElements(By.className("jobs-company-card__content-wrapper"));

the result (element) is an empty List , noting is returned

Upvotes: 0

Views: 58

Answers (2)

Dali Hamzaoui
Dali Hamzaoui

Reputation: 41

SOLVED all i had to do is add this

                    WebDriverWait wait= new WebDriverWait(driver,20 );
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.jobs-company-card__content-wrapper")));

Upvotes: 1

dev
dev

Reputation: 842

Have you tried using CSS selectors instead?

driver.findElements(By.cssSelector(".jobs-company-card__content-wrapper"));

Upvotes: 0

Related Questions