have a special web page can't find any elements

Viewed 69

The website is https://www.gaitame.com/bo/demo.html

in middle have a button with japanese "デモトレード版を利用する"

then will be go to a demo trader page like this

in this page i cant get any elements

other page is all right

i already switch_to this tab

please help.............

here is my testing code

from selenium import webdriver
import time
url = 'https://www.gaitame.com/bo/demo.html'
driver = webdriver.Chrome()
driver.get(url)
# Click the button and wait for loading
driver.find_element_by_class_name("blue2btn").click()
time.sleep(5)
# Switch to another tab
driver.switch_to.window(driver.window_handles[1])
# Try find any elements
driver.find_elements_by_class_name("header_area")

this is error msg

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2963, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-ed6cc8fa6e76>", line 14, in <module>
    driver.find_elements_by_class_name("header_area")
  File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 580, in find_elements_by_class_name
    return self.find_elements(by=By.CLASS_NAME, value=name)
  File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1007, in find_elements
    'value': value})['value'] or []
  File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: Unsupported locator strategy: null
  (Session info: chrome=80.0.3987.132)
2 Answers

This is a newly introduced Chromedriver bug.

Try using an older version of Chrome or another browser. I just tried your code in Firefox 73 and it worked.

Hope this helps and good luck!

the bug seems to still be in chromedriver. it's related to switching to a new window or tab.

However, in the OP's post, I don't see how he created the 2nd tab. he just switches to the tab/window with this

driver.switch_to.window(driver.window_handles[1])

It's possible the original problem here, was not creating the 2nd tab/window correctly.

Or it could be the existing chromedriver problem (which is intermittent/dependent on web page)

see here https://bugs.chromium.org/p/chromedriver/issues/detail?id=3390

The exception I'm tracking (which the OP reported) is this

selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: Unsupported locator strategy: null
Related