1

**My code works fine on my computer but in google cloud i am getting same error over and over again. **

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# Set the path to the Chrome binary and ChromeDriver

chrome_options = Options()
chrome_options.binary_location = "...."
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--remote-debugging-port=9222")
chrome_options.add_argument("window-size=1920x1080")

# Start the Chrome browser

browser = webdriver.Chrome(options=chrome_options)

# Navigate to the Google homepage

browser.get("https://www.google.com.tr")

search_box = WebDriverWait(browser, 10).until(
EC.element_to_be_clickable((By.NAME, "q"))
)
print(search_box)
\#EC.element_to_be_clickable

# Enter the search query and submit the form

search_box.send_keys("Python programming")
search_box.submit()

print(browser.title)

this is error that i had. It works fine on my local computer.

raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable (Session info: headless chrome=112.0.5615.49) Stacktrace: \#0 0x555c82055a23 \<unknown\> \#1 0x555c81d83821 \<unknown\> \#2 0x555c81dba24c \<unknown\> \#3 0x555c81db9a66 \<unknown\> \#4 0x555c81de13c2 \<unknown\> \#5 0x555c81db5463 \<unknown\> \#6 0x555c81de158e \<unknown\> \#7 0x555c81df9d06 \<unknown\> \#8 0x555c81de1193 \<unknown\> \#9 0x555c81db3b5a \<unknown\> \#10 0x555c81db4c9e \<unknown\> \#11 0x555c8201775d \<unknown\> \#12 0x555c8201b60c \<unknown\> \#13 0x555c82024800 \<unknown\> \#14 0x555c8201c703 \<unknown\> \#15 0x555c81fef3c5 \<unknown\> \#16 0x555c8203f558 \<unknown\> \#17 0x555c8203f6e7 \<unknown\> \#18 0x555c8204d4b3 \<unknown\> \#19 0x7ff3aa79eea7 start_thread
Mike Szyndel
  • 10,461
  • 10
  • 47
  • 63
  • Does this answer your question? [How do you fix the "element not interactable" exception?](https://stackoverflow.com/questions/44119081/how-do-you-fix-the-element-not-interactable-exception) – SimonUnderwood Apr 05 '23 at 14:04
  • Is that the [*full text* of the error/traceback](https://meta.stackoverflow.com/q/359146)? – MattDMo Apr 05 '23 at 14:05
  • First off, do you have Chrome installed on the server? Second, why are you running it in headless mode (which you should be doing) while also setting the window size? – MattDMo Apr 05 '23 at 14:07
  • @SimonUnderwood I don't think that link provides anything useful to the OP, as they're already incorporating things suggested there into their code. – MattDMo Apr 05 '23 at 14:17
  • Is this GAE Flex environment? – NoCommandLine Apr 05 '23 at 14:44
  • @MattDMo I just try other suggestions that's why windows size was there but I tried this code without setting window size as well. I have google chrome on my google cloud server if want to get just title of the browser(just for testing google chrome) it works fine. But if I want get element from page it just couldn't find it. – OZİDEA IDEAD Apr 05 '23 at 16:18

0 Answers0