question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error Msg "selenium.common.exceptions.TimeoutException: Message:"

See original GitHub issue

Hi …

i can`t execute the script and it show error msg “selenium.common.exceptions.TimeoutException: Message:”

My Simple script ( To send Message ) : from whatsapp import WhatsApp whatsapp = WhatsApp(100, session="mysession") print(whatsapp.send_message("Same",":heart: Good!"))

first cmd output : https://b.top4top.io/p_1887puw2p1.png

its open whatsapp web page but after a while it show me error : https://c.top4top.io/p_18876h5wc2.png

DevTools listening on ws://127.0.0.1:52819/devtools/browser/eb05022d-aacf-45aa-8 7bd-a822c0d99afa [0302/121025.282:ERROR:gl_surface_egl.cc(773)] EGL Driver message (Error) eglQue ryDeviceAttribEXT: Bad attribute. Traceback (most recent call last): File "XXXXXXXXXXXXXXX\Simple-Yet-Hackable-WhatsApp-api-master\test.py" , line 2, in <module> whatsapp = WhatsApp(50, session="mysession") File "XXXXXXXXXXXXXXX\Simple-Yet-Hackable-WhatsApp-api-master\whatsapp .py", line 61, in __init__ WhatsAppElements.search)) File "XXXXXXXXXXXXXXX\Python\Python37-32\lib\site-packa ges\selenium\webdriver\support\wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:

with no more actions on the whatsapp web page, So please help me to solve this issues !

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
liberticlcommented, Apr 10, 2021

Hello, I’m new using GitHub. I’ve faced the same issue these last days. I found a solution in other repo using selenium with whatsapp web (can’t find it now).

In the whatsapp.py file, on send_message definition (and others that can need to be solved) change search = self.browser.find_element(*WhatsAppElements.search) By search = self.browser.find_element_by_xpath('//*[@id="side"]/div[1]/div/label/div/div[2]')

Furthermore, it is needed to change ._1awRl in line 36 by the CSS element that is being used now (._3LX7r).

Hope I’ve been helpful

1reaction
zooser22commented, Apr 13, 2021

I appreciate your hard work for supporting this script

I suggest to add function to Send Anonymous picture using this code : # Send Anonymous Picture

    def send_file_x(self, phone, text,picture_location, caption=None):
        payload = urlencode({"phone": phone, "text": text, "source": "", "data": ""})
        print (payload)
        self.browser.get("https://web.whatsapp.com/send?"+payload)
        time.sleep(1)
        try:
            Alert(self.browser).accept()
        except:
            print("No alert Found")
            time.sleep(5)
        try:
            send_file_xpath = '/html/body/div[1]/div/div/div[2]/div[2]/span/div/span/div/div/div[2]/span/div/div/span'
            attach_type_xpath = '/html/body/div[1]/div/div/div[4]/div/footer/div[1]/div[1]/div[2]/div/span/div/div/' \
                                'ul/li[1]/button/input'
            # open attach menu
            attach_btn = self.browser.find_element(*WhatsAppElements.attach_icon)
            attach_btn.click()
            # Find attach file btn and send screenshot path to input
            time.sleep(1)
            attach_img_btn = self.browser.find_element_by_xpath(attach_type_xpath)
            # TODO - might need to click on transportation mode if url doesn't work
            attach_img_btn.send_keys(picture_location)           # get current script path + img_path
            time.sleep(1)
            if caption:
                caption_xpath = "/html/body/div[1]/div/div/div[2]/div[2]/span/div/span/div/div/div[2]/div[1]/span/" \
                                "div/div[2]/div/div[3]/div[1]/div[2]"
                send_caption = self.browser.find_element_by_xpath(caption_xpath)
                send_caption.send_keys(caption)
            send_btn = self.browser.find_element_by_xpath(send_file_xpath)
            send_btn.click()
            time.sleep(5)
            self.browser.quit()
        except (NoSuchElementException, ElementNotVisibleException) as e:
            print(str(e))
Read more comments on GitHub >

github_iconTop Results From Across the Web

selenium.common.exceptions.TimeoutException error using ...
The WebDriverWait constructor takes a WebDriver instance as an argument and timeout in seconds. Hence, irrespective of usage of either of the ...
Read more >
selenium.common.exceptions.TimeoutException()
This page shows Python examples of selenium.common.exceptions.TimeoutException.
Read more >
TimeOutException in Selenium - Educative.io
In Selenium, TimeOut exception occurs when a command takes longer than the wait time to avoid the ElementNotVisible Exception.
Read more >
Message: Timed out waiting for page load. - Google Groups
From selenium point of view, page load did took too much time and therefore selenium did raise an exception. There are two common...
Read more >
i have this error:( raise TimeoutException(message, screen ...
[Code example]-i have this error:( raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: ) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found