0

I have some code in selenium/python, which used to work, But now I'm getting:

javascript error: Right-hand side of 'instanceof' is not an object

I don't know if it's something that was changed in the angular application, or how this error is relevant to what I'm doing. I get it after trying to locate a webelement or waiting for visibility of element, like:

wait.until(expected_conditions.visibility_of_element_located(leftNav_page.pageSmallTitle))

"pageSmallTitle" is just a locator like:

pageSmallTitle = (By.CSS_SELECTOR, "span[id$='componentTitle']")

Tried changing it to xpath, but didn't make a difference.

I would highly appreciate any suggestion!

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
skimchi
  • 1
  • 1

1 Answers1

0

visibility_of_element_located() accepts a locator as an argument and the expression is as follows:

wait.until(expected_conditions.visibility_of_element_located((By.CSS_SELECTOR, "span[id$='componentTitle']")))

In your usecase, if:

pageSmallTitle = (By.CSS_SELECTOR, "span[id$='componentTitle']")

the effective line of code must have been:

from selenium.webdriver.support import expected_conditions

wait.until(expected_conditions.visibility_of_element_located(pageSmallTitle))

so essentially there is an additional parameter as leftNav_page. Hence you see the error.

Removing the extra parameter will solve the issue.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • No, because leftNav_page is just the class I'm taking the pageSmallTitle from. It's the same for all other locators which work – skimchi Aug 10 '22 at 05:46