0

here is my code to hack password game: eventually it is saying that password circles(containers) is not interactable, how I can fix this?)

from time import sleep


driver = webdriver.Chrome()
driver.get('https://meduza.io/games/bud-hakerom-igra-meduzy')
xpath = driver.find_element_by_xpath
start_button = xpath('//*[@id="maincontent"]/div/div/div[2]/div[2]/div[3]/button')
start_button.click()
sleep(4)
driver.switch_to.frame('/embed/cows')
play_button = xpath('//*[@id="app"]/div/form/div[1]/div[1]/button')
play_button.click()
sleep(1)
first_container = xpath('//*[@id="app"]/div/div/div[1]/div[1]/div/div/span[1]')
second_container = xpath('//*[@id="app"]/div/div/div[1]/div[1]/div/div/span[2]')
third_container = xpath('//*[@id="app"]/div/div/div[1]/div[1]/div/div/span[3]')
fourth_container = xpath('//*[@id="app"]/div/div/div[1]/div[1]/div/div/span[4]')
for x in range(10):
    for y in range(10):
        for z in range(10):
            for t in range(10):
                first_container.send_keys(x)
                second_container.send_keys(y)
                third_container.send_keys(z)
                fourth_container.send_keys(t)```

1 Answer 1

1

ElementNotInteractableException is occured when an element is found, but you can not interact with it. you can using it with actionChains

There are so many reasons of it:

element is not visible / not displayed element is off screen element is behind another element or hidden

Find below code, I have tested this with hard coded value :

driver.get('https://meduza.io/games/bud-hakerom-igra-meduzy')
xpath = driver.find_element_by_xpath
start_button = xpath('//*[@id="maincontent"]/div/div/div[2]/div[2]/div[3]/button')
start_button.click()
time.sleep(5)
driver.switch_to.frame('/embed/cows')
play_button = xpath('//*[@id="app"]/div/form/div[1]/div[1]/button')
play_button.click()
time.sleep(5)
first_container = xpath('//*[@id="app"]/div/div/div[1]/div[1]/div/div/span[1]')
second_container = xpath('//*[@id="app"]/div/div/div[1]/div[1]/div/div/span[2]')
third_container = xpath('//*[@id="app"]/div/div/div[1]/div[1]/div/div/span[3]')
fourth_container = xpath('//*[@id="app"]/div/div/div[1]/div[1]/div/div/span[4]')


for x in range(10):
    for y in range(10):
        for z in range(10):
            for t in range(10):
                actionChains = ActionChains(driver)
                actionChains.move_to_element(first_container).click().perform()
                actionChains.move_to_element(first_container).send_keys("2").perform()

                actionChains.move_to_element(second_container).click().perform()
                actionChains.move_to_element(second_container).send_keys("3").perform()

                actionChains.move_to_element(third_container).click().perform()
                actionChains.move_to_element(third_container).send_keys("3").perform()

                actionChains.move_to_element(fourth_container).click().perform()
                actionChains.move_to_element(fourth_container).send_keys("3").perform()

Note : please add below imports to your solution

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.options import Options
import time
from selenium.webdriver.common.action_chains import ActionChains
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.