Skip to content

Commit 8965248

Browse files
committed
[Debug] attempts to fix #15 and #17
attempts to fix #15 and #17
1 parent d079758 commit 8965248

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

test/getAllLabels.py

+32-14
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
11
from selenium import webdriver
2-
driver = webdriver.Chrome()
3-
driver.get('https://etherscan.io/labelcloud')
4-
driver.implicitly_wait(5)
5-
6-
elems = driver.find_elements_by_xpath("//a[@href]")
7-
labels = []
8-
labelIndex = len('https://etherscan.io/accounts/label/')
9-
for elem in elems:
10-
href = elem.get_attribute("href")
11-
if (href.startswith('https://etherscan.io/accounts/label/')):
12-
labels.append(href[labelIndex:])
13-
14-
print(labels)
15-
print('L:', len(labels))
2+
from selenium.webdriver.chrome.service import Service as ChromeService
3+
from webdriver_manager.chrome import ChromeDriverManager
4+
import pandas as pd
5+
import json
6+
import time
7+
import os.path
8+
import re
9+
10+
baseUrl = 'https://bscscan.com'
11+
12+
13+
def getAllLabels():
14+
driver.get(baseUrl + '/labelcloud')
15+
driver.implicitly_wait(5)
16+
17+
elems = driver.find_elements("class name", "d-block")
18+
labels = []
19+
labelIndex = len(baseUrl + '/accounts/label/')
20+
for elem in elems:
21+
href = elem.get_attribute("href")
22+
print(href, '/ Text:', elem.text)
23+
24+
print(labels)
25+
print('L:', len(labels))
26+
27+
28+
if __name__ == '__main__':
29+
driver = webdriver.Chrome(service=ChromeService(
30+
ChromeDriverManager().install()))
31+
getAllLabels()
32+
33+
driver.quit()

0 commit comments

Comments
 (0)