fix deprecated find_elements_by* and find_element_by*

This commit is contained in:
2025-03-13 04:53:43 -07:00
parent 1aabfdbcce
commit 5895102451
20 changed files with 255 additions and 218 deletions

View File

@@ -1,8 +1,11 @@
from unittest import TestCase
from pathlib import Path
from unittest import TestCase
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
OPTIONS = Options()
OPTIONS.add_argument('--ignore-certificate-errors')
OPTIONS.add_argument('--incognito')
@@ -25,5 +28,5 @@ class TestSelenium(TestCase):
class TestIDsForDuplicates(TestSelenium, TestCase):
def test_for_unique_ids(self):
ids = [x.get_attribute(
'id') for x in self.driver.find_elements_by_xpath('//*[@id]')]
'id') for x in self.driver.find_elements(By.XPATH, '//*[@id]')]
self.assertEqual(len(ids), len(set(ids)))