jeudi 22 août 2019

error of element not interactable in whatsapp web

I want to use WhatsApp web by python. I used the same code in two different laptops. In one, it worked fine, and in the other one I got the error:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable (Session info: chrome=76.0.3809.100)

This is my code:

from selenium import webdriver 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.common.keys import Keys 
from selenium.webdriver.common.by import By 
import time 

driver = webdriver.Chrome(executable_path="/home/kouhi/kouhi-company/idea1/python-code/chromedriver")
driver.get("https://web.whatsapp.com/") 

wait = WebDriverWait(driver,600) 

target = "test"
string = "Message sent using Python!!!"

x_arg = '//span[contains(@title,' + target + ')]'
group_title = wait.until(EC.presence_of_element_located((By.XPATH, x_arg))) 
group_title.click() 
inp_xpath = '//div[@class="input"][@dir="auto"][@data-tab="1"]'
input_box = wait.until(EC.presence_of_element_located((By.XPATH, inp_xpath))) 
for i in range(10): 
    input_box.send_keys(string + Keys.ENTER) 
    time.sleep(1) 

If the point is that send key is not clickable, then this code should not work on the other laptop. So, the problem is somewhere else. That would be great if you can help me.




Aucun commentaire:

Enregistrer un commentaire