0

I am trying to press one 'li' element by CSS Selector with Selenium in Python. The URL. The problem is: when I run python code on windows computer, it works, when I run the same code on Linux Ubuntu server, it gets error. Here is my code:

WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, "li[class*=member-nav__time]"))).click()

I also tried this (didn`t help):

el = WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "li[class*=member-nav__time]")))
el.click()

My error is:

Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/usr/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/var/www/fastuser/data/CalendarSeleniumBot/main.py", line 433, in update_news
usd = sel.get_USD_news()
File "/var/www/fastuser/data/CalendarSeleniumBot/main.py", line 143, in get_USD_news
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, 
"li[class*=member-nav__time]"))).click()
File "/var/www/fastuser/data/CalendarSeleniumBot/env/lib/python3.9/site- 
packages/selenium/webdriver/support/wait.py", line 95, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Stacktrace:
#0 0x56184140bfe3 <unknown>
#1 0x56184114ad36 <unknown>
#2 0x561841187c4d <unknown>
#3 0x561841187d61 <unknown>
#4 0x5618411c36a4 <unknown>
#5 0x5618411a88ed <unknown>
#6 0x5618411c1232 <unknown>
#7 0x5618411a8693 <unknown>
#8 0x56184117b03a <unknown>
#9 0x56184117c17e <unknown>
#10 0x5618413cddbd <unknown>
#11 0x5618413d1c6c <unknown>
#12 0x5618413db4b0 <unknown>
#13 0x5618413d2d63 <unknown>
#14 0x5618413a5c35 <unknown>
#15 0x5618413f6138 <unknown>
#16 0x5618413f62c7 <unknown>
#17 0x561841404093 <unknown>
#18 0x7fc88d8abea7 start_thread

But in the start, it was 'Element is not iterable'

I use undetected_chomedriver.Chrome.

0 Answers0