I am building a bot for the skype web client (https://web.skype.com/en)
using Selenium. Everything works like a charm but after a few moments I am getting the error 10048:
Address already in use. Only one usage of each socket address (protocol/IP address/port) is normally permitted
I checked netstat -n and saw that my programm creates a huge amount of connections.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
#driver = webdriver.Chrome(executable_path='c:\Python34\chromedriver.exe')
driver = webdriver.Firefox(executable_path='c:\Program Files\MozillaFirefox\firefox.exe')
driver.get("https://web.skype.com/de/")
time.sleep(8)
login = driver.find_element_by_id("username")
login.send_keys("username")
password = driver.find_element_by_id("password")
password.send_keys("password" + Keys.RETURN)
time.sleep(15)
newest2 = ""
sending = driver.find_element_by_name("messageInput")
message = driver.find_element_by_xpath("//*[@id='chatComponent']/div/swx-navigation/div/div/div/swx-chat-log/div[2]")
while 1==1 :
newest = message.get_attribute("textContent")
print(newest)
if newest2 != newest:
if '!reactionTest' in newest:
sending.send_keys("Check" + Keys.RETURN)
newest2 = newest
print("done")
I think that each time I call newest = message.get_attribute("textContent")
a new connection is created. Because when I am not using the message element which always shows the newest message I am not encountering the problem. I can't seem to find a solution on google regarding this problem including selenium. Isn't there any way to close each connection at the end of the infinite loop? Any help is greatly appreciated :)