Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99411

Selenium "selenium.common.exceptions.NoSuchElementException" when using Chrome

$
0
0

I'm trying to play QWOP using Selenium on Chrome but I keep getting the following error:

selenium.common.exceptions.NoSuchElementException: 
Message: no such element: Unable to locate element
{"method":"id","selector":"window1"
(Session info: chrome=63.0.3239.108
(Driver info: chromedriver=2.34.522913
(36222509aa6e819815938cbf2709b4849735537c), platform=Linux 4.10.0-42-generic x86_64)

while using the following code:

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time

browser = webdriver.Chrome()
browser.set_window_size(640, 480)
browser.get('http://www.foddy.net/Athletics.html?webgl=true')
browser.implicitly_wait(10)

canvas = browser.find_element_by_id("window1")

canvas.click()

while (True):
    action = ActionChains(browser)
    action.move_to_element(canvas).perform()
    canvas.click()
    canvas.send_keys("q")

The same code works perfectly on Firefox, but because I want to use chrome's capability to run an webgl game in headless mode I can't really switch to Firefox.

Any workarounds to get this working?


Viewing all articles
Browse latest Browse all 99411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>