I've been working on Cross-Browser-Testing with my team for a while now and I've sorted out my Chrome tests.
So today I decided to try running my teammate's Edge tests and I'm getting the ResourceWarning: Enable tracemalloc to get the object allocation traceback
message like crazy. About every second or so it prints out 1 to 3 of the same message.
I remember getting this message occassionaly while running Chrome tests during the beginning, but never to the extreme amount I got from Edge.
I've done some minor research (1, 2, 3) so I know this doesn't affect my Selenium runs.
But I'm curious as to what behind-the-scenes things are happening to cause this more on Edge than Chrome.
For specific information about my Edge Driver, I'm using the one from the Microsoft site for Edge version 80.0.361.66. I did do some config testing to see if that made any difference (driver version and edge version) but still the same amount.
This is especially weird because Edge uses Chromium. I'm wondering if it's an issue with how Selenium controls Edge.
Here's a sample Minimum Viable Code for Chrome
import time
import unittest
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
class test_state(unittest.TestCase):
@classmethod
def setUp(self):
self.driver = Chrome('__tests__/drivers/chromedriver.exe')
self.driver.maximize_window()
self.driver.get("https://adbanker.com/")
def test_state(self):
try:
url = self.driver.current_url
print(url)
time.sleep(5)
title = self.driver.title
print(title)
WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.XPATH,'//*[@id="for"]')))
lr = WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.ID,'statenav')))
lr.click()
ce = WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.XPATH,'//*[@id="line_dropdown"]/option[3]')))
ce.click()
ca = WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.XPATH,'//*[@id="state_dropdown"]/option[6]')))
ca.click()
time.sleep(5)
except:
raise
@classmethod
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
unittest.main()
And here's a sample Minimum Viable Code for Edge
import time
import unittest
from selenium.webdriver import Edge
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
class test_state(unittest.TestCase):
@classmethod
def setUp(self):
self.driver = Edge('__tests__/drivers/msedgedriver.exe')
self.driver.maximize_window()
self.driver.get("https://adbanker.com/")
def test_state(self):
try:
url = self.driver.current_url
print(url)
time.sleep(5)
title = self.driver.title
print(title)
WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.XPATH,'//*[@id="for"]')))
lr = WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.ID,'statenav')))
lr.click()
ce = WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.XPATH,'//*[@id="line_dropdown"]/option[3]')))
ce.click()
ca = WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.XPATH,'//*[@id="state_dropdown"]/option[6]')))
ca.click()
time.sleep(5)
except:
raise
@classmethod
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
unittest.main()
I've been doing more research on this, and specifically this error is pointing to line 374 of this file in Selenium's remote driver.
Upon closer inspection, it's hitting an if condition on line 374 and just doesn't know what to do, so it fails. But why?