Skip to content

Commit 11b432c

Browse files
authored
Merge pull request #22 from brave-intl/hotfix/site-change
Fix Failure After Site Change
2 parents c1b2f4c + 6699c6d commit 11b432c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

ofac_scraper.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from selenium.common.exceptions import TimeoutException
55
from selenium.webdriver.chrome.service import Service
66
from selenium.webdriver.chrome.options import Options
7+
from selenium.webdriver.common.action_chains import ActionChains
78
from selenium.webdriver.common.by import By
89
from selenium.webdriver.support.ui import WebDriverWait
910
from selenium.webdriver.support import expected_conditions as EC
@@ -31,10 +32,6 @@ def wait_for_element(self, by, value, timeout=30):
3132
EC.presence_of_element_located((by, value))
3233
)
3334

34-
def click_element(self, by, value):
35-
element = self.driver.find_element(by, value)
36-
element.click()
37-
3835
def get_element_text(self, by, value):
3936
return self.driver.find_element(by, value).text
4037

@@ -51,21 +48,25 @@ def get_sha256_checksum(self):
5148
print("Website opened")
5249

5350
# Wait until the 'File Signatures' button with the known ID is present
54-
self.wait_for_element(By.ID, "accordion__heading-raa-1")
51+
self.wait_for_element(By.ID, "accordion__heading-:r1:")
5552
print("File Signatures button found")
5653

57-
# Click the 'File Signatures' button with the known ID
58-
self.click_element(By.ID, "accordion__heading-raa-1")
54+
# Scroll to (waiting for animation) and Click the 'File
55+
# Signatures' button with the known ID
56+
header_element = self.driver.find_element(By.ID, "accordion__heading-:r1:")
57+
ActionChains(self.driver).move_to_element(header_element).perform()
58+
time.sleep(1)
59+
header_element.click()
5960
print("File Signatures button clicked")
6061

6162
# Wait for the checksums panel to be visible
62-
self.wait_for_element(By.ID, "accordion__panel-raa-1")
63+
self.wait_for_element(By.ID, "accordion__panel-:r1:")
6364
time.sleep(3)
6465
print("Checksums panel found")
6566

6667
# Extract the checksums content
6768
checksums_content = self.get_element_text(
68-
By.ID, "accordion__panel-raa-1"
69+
By.ID, "accordion__panel-:r1:"
6970
)
7071
print("Checksums content extracted")
7172

0 commit comments

Comments
 (0)