def no_enough_public_address_amount(): # send TRY login process driver = Browser().open_browser() # Enter the page driver.get('https://wallet.trias.one/') driver.find_element_by_xpath('/html/body/div/div/main/div/a[2]/div[1]/h2').click() # Gets the file name under the downloadfile folder mydir = os.path.abspath('..') url = mydir + "\\downloadfile\\" files = GetFileName().getfilename(url) # Calculate folder length len1 = len(os.listdir(url)) v1 = url + files[len1 - 2] wait = WebDriverWait(driver, 60) wait.until(EC.presence_of_all_elements_located((By.XPATH,'//*[@id="fselector"]'))) # Upload a file driver.find_element_by_xpath('//*[@id="fselector"]').send_keys(v1) driver.implicitly_wait(5) # Enter the password driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(123456789) wait.until(EC.element_to_be_clickable((By.XPATH,'//*[contains(text(),"UNLOCK")]'))) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(Keys.TAB) # login time.sleep(9) for i in range(2): try: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a').click() except Exception as e: pass # get public address balance time.sleep(2) for i in range(100): public_account_balance = driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div[1]/div[2]/div[2]/div[1]/ul/li/span').text time.sleep(2) if int(public_account_balance) != 0: break # Transaction process time.sleep(2) # Get the name and address of the transfer target account splits=files[len1-1].split('--') driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[1]/div[1]/input').send_keys(splits[2]) # Random transfer amount rand=random.randint(1,150) rand2=rand+int(public_account_balance) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/section/div[2]/div/input').send_keys(rand2) # Click the trade button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[2]/div/a').click() time.sleep(3) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[2]/section/section/div[2]/button[2]').click() time.sleep(5) driver.quit()
def creat_wallet(): driver = Browser().open_browser() # Enter the homepage driver.get('https://wallet.trias.one/') time.sleep(3) # Click create wallet driver.find_element_by_xpath( '/html/body/div/div/main/div/a[1]/div[1]').click() driver.implicitly_wait(2) # Enter password and click ok to create driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/section/div[2]/input' ).send_keys('123456789') time.sleep(4) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/section/a').click() driver.implicitly_wait(5) # Click to download the file and confirm that it has been downloaded driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[2]/section/a/span').click( ) time.sleep(10) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[2]/section/p/a').click() time.sleep(3) driver.quit()
def getcoin(): # get config TRY coins coin = GetConf().get_coins('theCoins','coin') driver = Browser().open_browser() bs = BasePage(driver) driver.get('https://wallet.trias.one/api/getCoinbase/') # Gets the file name under the downloadfile folder mydir = os.path.abspath('..') url = mydir + "\\downloadfile\\" files=GetFileName().getfilename(url) # Calculate folder length len1 = len(os.listdir(url)) w = files[len1-2] w1 = w.split('--')[2] time.sleep(10) driver.find_element_by_xpath('//*[@id="change_margin_1"]/input').send_keys(w1) time.sleep(3) ''' creat TRY coin ''' for i in range(int(coin)//100): bs.find_element('classname<=>content-form-signup').click() time.sleep(1) driver.quit()
def get_hidden_coin(): # get config TRY coins hidden_coin = GetConf().get_coins('theCoins', 'hidden_coin') driver = Browser().open_browser() bs=BasePage(driver) driver.get('https://wallet.trias.one/api/getCoinbase/') # Gets the file name under the downloadfile folder mydir = os.path.abspath('..') url = mydir + "\\downloadfile\\" files = GetFileName().getfilename(url) # Calculate folder length len1 = len(os.listdir(url)) w = files[len1-2] w1 = w.split('--')[2] # Check the private address time.sleep(10) driver.find_element_by_name('user').send_keys(w1) element0 = driver.find_elements_by_xpath("//*[@id='send_type_select']/label") for ele0 in element0: if ele0.is_displayed(): ele0.click() time.sleep(3) ''' creat hidden TRY coin ''' for i in range(int(hidden_coin)//100): bs.find_element('classname<=>content-form-signup').click() time.sleep(1) driver.quit()
def check_view_account_info(): # get config coin and hidden coin coin=GetConf().get_coins('theCoins','coin') hidden_coin = GetConf().get_coins('theCoins','hidden_coin') account_all_coins = int(coin)+int(hidden_coin) # The login process for send TRY driver = Browser().open_browser() # Enter the page driver.get('https://wallet.trias.one/') time.sleep(2) for i in range(100): # enter the homepage driver.find_element_by_xpath( '/html/body/div/div/div[2]/div[2]/div/ul/li[1]/a/span').click() driver.find_element_by_xpath( '//*[@id="app"]/div/div[2]/div[2]/div/ul/li[4]/a/span').click() # Gets the file name under the downloadfile folder mydir = os.path.abspath('..') url = mydir + "\\downloadfile\\" files = GetFileName().getfilename(url) # Calculate folder length len1 = len(os.listdir(url)) v1 = url + files[len1 - 2] wait = WebDriverWait(driver, 60) wait.until(EC.presence_of_all_elements_located((By.XPATH, '//*[@id="fselector"]'))) # Upload a file driver.find_element_by_xpath('//*[@id="fselector"]').send_keys(v1) driver.implicitly_wait(5) # Enter the password driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(123456789) wait.until(EC.element_to_be_clickable((By.XPATH, '//*[contains(text(),"UNLOCK")]'))) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(Keys.TAB) # to login time.sleep(8) try: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a').click() except RuntimeError as e: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a').click() print(e) for j in range(40): # get account total balance time.sleep(1) account_total_balance = driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/div[2]/div[1]/div[2]/ul/li/span').text if int(account_total_balance) != 0: break if int(account_total_balance) == int(account_all_coins): break time.sleep(3) driver.quit()
class BaseWebTestCase(unittest.TestCase): def setUp(self): warnings.simplefilter("ignore", ResourceWarning) warnings.simplefilter("ignore", DeprecationWarning) self.web_driver = Browser().open_browser() def tearDown(self): self.web_driver.close() self.web_driver.quit() def save_img(self, img_name): img_path = os.path.join(base_dir, 'img') self.web_driver.get_screenshot_as_file( '{}/{}.png'.format(img_path, img_name))
def no_enough_private_address_hidden_amount(self): '---------------------Log in and check the amount--------------------------------------------' #send TRY login process driver=Browser().open_browser() #Enter the page driver.get('https://wallet.trias.one/') driver.find_element_by_xpath('/html/body/div/div/main/div/a[2]/div[1]/h2').click() #Gets the file name under the downloadfile folder dir = os.path.abspath('..') url = dir + "\\downloadfile\\" files=GetFileName().getfilename(url) # Calculate folder length len1 = len(os.listdir(url)) v1 = url + files[len1 - 2] wait = WebDriverWait(driver, 60) wait.until(EC.presence_of_all_elements_located((By.XPATH,'//*[@id="fselector"]'))) #Upload a file driver.find_element_by_xpath('//*[@id="fselector"]').send_keys(v1) driver.implicitly_wait(5) #Enter the password driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(123456789) wait.until(EC.element_to_be_clickable((By.XPATH,'//*[contains(text(),"UNLOCK")]'))) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(Keys.TAB) #login time.sleep(9) for i in range(2): try: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a').click() except: pass #get private address balance time.sleep(2) for i in range(100): private_address_balance = driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/div[2]/div[2]/div[3]/ul/li/span').text total_account_balance = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[1]/div[2]/ul/li/span').text time.sleep(2) if int(total_account_balance) != 0: break '---------------------------------------------Transaction process-----------------------------------' time.sleep(2) #Get the name and address of the transfer target account splits=files[len1-1].split('--') driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[1]/div[1]/input').send_keys(splits[2]) #send how much amount amount=int(private_address_balance)-50 driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/section/div[2]/div/input').send_keys(amount) time.sleep(2) # Click the private address button driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/div[3]/article/article[1]/a[1]').click() # Click the hide amount button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/a[2]').click() time.sleep(1) #Click the trade button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[2]/div/a').click() time.sleep(3) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[2]/section/section/div[2]/button[2]').click() #Wait for the trade page to change try: wait.until(EC.presence_of_all_elements_located(( By.XPATH, '/html/body/div/div/main/div/div[1]/article[2]/section/a[2]/span'))) except: print('Transaction timeout') time.sleep(3) '-------------------------------------------check account----------------------------------------------' for i in range(100): time.sleep(2) #enter the homepage driver.find_element_by_xpath('/html/body/div/div/div[2]/div[2]/div/ul/li[1]/a/span').click() # click the view account info driver.find_element_by_xpath('/html/body/div/div/div[2]/div[2]/div/ul/li[4]/a/span').click() # Upload a file driver.find_element_by_xpath('//*[@id="fselector"]').send_keys(v1) driver.implicitly_wait(5) # enter the password driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(123456789) wait.until(EC.element_to_be_clickable((By.XPATH, '//*[contains(text(),"UNLOCK")]'))) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(Keys.TAB) # 登陆 time.sleep(8) try: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a').click() except: print('This element was not found') # get account_total_amount again time.sleep(2) for i in range(100): account_total_amount_second = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[1]/div[2]/ul/li/span').text time.sleep(2) if int(total_account_balance) != 0: break time.sleep(1) if int(account_total_amount_second) != int(total_account_balance): print('The account has been updated. Please check') break time.sleep(5) #login process # enter the homepage driver.find_element_by_xpath('/html/body/div/div/div[2]/div[2]/div/ul/li[1]/a/span').click() driver.find_element_by_xpath('/html/body/div/div/div[2]/div[2]/div/ul/li[3]/a/span').click() # Upload a file driver.find_element_by_xpath('//*[@id="fselector"]').send_keys(v1) driver.implicitly_wait(5) # Enter the password driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(123456789) wait.until(EC.element_to_be_clickable((By.XPATH, '//*[contains(text(),"UNLOCK")]'))) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input').send_keys(Keys.TAB) # login time.sleep(9) for i in range(2): try: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a').click() except: pass '-----------------------------Second Transaction process-----------------------------------------' # Get the name and address of the transfer target account splits = files[len1 - 1].split('--') driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[1]/div[1]/input').send_keys(splits[2]) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/section/div[2]/div/input').send_keys(50) # Click the private address button driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/div[3]/article/article[1]/a[1]').click() time.sleep(2) # Click the hide amount button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/a[2]').click() time.sleep(3) # Click the trade button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[2]/div/a').click() time.sleep(3) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[2]/section/section/div[2]/button[2]').click() time.sleep(5) driver.quit()
def send_private_address_hidden_amount(): # Send TRY login process driver = Browser().open_browser() # Enter the page driver.get('https://wallet.trias.one/') driver.find_element_by_xpath( '/html/body/div/div/main/div/a[2]/div[1]/h2').click() # Gets the file name under the downloadfile folder mydir = os.path.abspath('..') url = mydir + "\\downloadfile\\" files = GetFileName().getfilename(url) # Calculate folder length len1 = len(os.listdir(url)) v1 = url + files[len1 - 2] wait = WebDriverWait(driver, 60) wait.until( EC.presence_of_all_elements_located( (By.XPATH, '//*[@id="fselector"]'))) # Upload a file driver.find_element_by_xpath('//*[@id="fselector"]').send_keys(v1) driver.implicitly_wait(5) # Enter the password driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input' ).send_keys(123456789) wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[contains(text(),"UNLOCK")]'))) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input' ).send_keys(Keys.TAB) # login time.sleep(9) try: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a' ).click() except FileNotFoundError as e: print(e) # Transaction process # Get account amount information time.sleep(2) for i in range(50): time.sleep(1) account_total_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[1]/div[2]/ul/li/span' ).text public_address_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[1]/ul/li/span' ).text public_address_hideen_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[2]/ul/li/span' ).text private_address_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[3]/ul/li/span' ).text private_address_hidden_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[4]/ul/li/span' ).text if int(account_total_amount) != 0: break # Get the name and address of the transfer target account splits = files[len1 - 1].split('--') driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[1]/div[1]/input' ).send_keys(splits[2]) # Random transfer amount rand = random.randint(1, 150) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/section/div[2]/div/input' ).send_keys(rand) # Click the hide address button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/a[1]' ).click() # Click the hide amount button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/a[2]' ).click() # Click the trade button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[2]/div/a' ).click() time.sleep(3) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[2]/section/section/div[2]/button[2]' ).click() # Wait for the trade page to change try: wait.until( EC.presence_of_all_elements_located(( By.XPATH, '/html/body/div/div/main/div/div[1]/article[2]/section/a[2]/span' ))) except FileNotFoundError as e: print(e) time.sleep(2) for i in range(100): time.sleep(2) # enter the homepage driver.find_element_by_xpath( '/html/body/div/div/div[2]/div[2]/div/ul/li[1]/a/span').click( ) # Check the view account info driver.find_element_by_xpath( '/html/body/div/div/div[2]/div[2]/div/ul/li[4]/a/span').click( ) # Upload a file driver.find_element_by_xpath('//*[@id="fselector"]').send_keys(v1) driver.implicitly_wait(5) # Enter the password driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input' ).send_keys(123456789) wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[contains(text(),"UNLOCK")]'))) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input' ).send_keys(Keys.TAB) # login time.sleep(8) try: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a' ).click() except FileNotFoundError as e: print(e) # Get account_total_amount again time.sleep(2) for i in range(50): account_total_amount_second = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[1]/div[2]/ul/li/span' ).text time.sleep(2) if int(account_total_amount_second) != 0: break if int(account_total_amount_second) != int(account_total_amount): # Record the account amount and store it in excel public_address_amount2 = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[1]/ul/li/span' ).text public_address_hideen_amount2 = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[2]/ul/li/span' ).text private_address_amount2 = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[3]/ul/li/span' ).text private_address_hidden_amount2 = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[4]/ul/li/span' ).text flag = True if (int(private_address_amount) + int(private_address_hidden_amount) - rand) != (int(private_address_amount2) + int(private_address_hidden_amount2)): flag = False WriteExcel().write_excel_xls_append([ public_address_amount, public_address_hideen_amount, private_address_amount, private_address_hidden_amount, 'send private address hidden amount: ' + str(rand) + 'TRY', public_address_amount2, public_address_hideen_amount2, private_address_amount2, private_address_hidden_amount2, flag ]) print('The account has been updated. Please check') break time.sleep(5) driver.quit()
def send_public_address_hidden_amount(self): driver = Browser().open_browser() #Enter the page driver.get('https://wallet.trias.one/') driver.find_element_by_xpath( '/html/body/div/div/main/div/a[2]/div[1]/h2').click() #gets all filenames in the downloadfile dir = os.path.abspath('..') url = dir + "\\downloadfile\\" files = GetFileName().getfilename(url) # 计算文件夹长度 len1 = len(os.listdir(url)) v1 = url + files[len1 - 2] wait = WebDriverWait(driver, 60) wait.until( EC.presence_of_all_elements_located( (By.XPATH, '//*[@id="fselector"]'))) #Upload a file driver.find_element_by_xpath('//*[@id="fselector"]').send_keys(v1) driver.implicitly_wait(5) #enter the password driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input' ).send_keys(123456789) wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[contains(text(),"UNLOCK")]'))) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input' ).send_keys(Keys.TAB) #to login time.sleep(8) try: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a' ).click() except: print('This element was not found') #Transaction process time.sleep(2) #Get account amount information account_total_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[1]/div[2]/ul/li/span' ).text public_address_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[1]/ul/li/span' ).text public_address_hideen_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[2]/ul/li/span' ).text private_address_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[3]/ul/li/span' ).text private_address_hidden_amount = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[4]/ul/li/span' ).text #Get the name and address of the transfer target account splits = files[len1 - 1].split('--') driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[1]/div[1]/input' ).send_keys(splits[2]) #random transfer amount rand = random.randint(1, 150) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/section/div[2]/div/input' ).send_keys(rand) #Click the hide amount button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/a[2]' ).click() #Click the trade button driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[1]/div[2]/div/a' ).click() time.sleep(3) driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[3]/article/article[2]/section/section/div[2]/button[2]' ).click() #Wait for the trade page to change try: wait.until( EC.presence_of_all_elements_located(( By.XPATH, '/html/body/div/div/main/div/div[1]/article[2]/section/a[2]/span' ))) except: print('Transaction timeout') time.sleep(3) for i in range(100): time.sleep(2) #enter the homepage driver.find_element_by_xpath( '/html/body/div/div/div[2]/div[2]/div/ul/li[1]/a/span').click( ) #click the view account info driver.find_element_by_xpath( '/html/body/div/div/div[2]/div[2]/div/ul/li[4]/a/span').click( ) #Upload a file driver.find_element_by_xpath('//*[@id="fselector"]').send_keys(v1) driver.implicitly_wait(5) #enter the password driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input' ).send_keys(123456789) wait.until( EC.element_to_be_clickable( (By.XPATH, '//*[contains(text(),"UNLOCK")]'))) driver.find_element_by_xpath( '//*[@id="app"]/div/main/div/div/article[1]/div[2]/article/div/div[2]/input' ).send_keys(Keys.TAB) #登陆 time.sleep(8) try: driver.find_element_by_xpath( '/html/body/div/div/main/div/div/article[1]/div[2]/article/div/div[3]/a' ).click() except: print('This element was not found') time.sleep(8) #get account_total_amount again account_total_amount_second = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[1]/div[2]/ul/li/span' ).text if account_total_amount_second != account_total_amount: #Record the account amount and store it in XLS public_address_amount2 = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[1]/ul/li/span' ).text public_address_hideen_amount2 = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[2]/ul/li/span' ).text private_address_amount2 = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[3]/ul/li/span' ).text private_address_hidden_amount2 = driver.find_element_by_xpath( '/html/body/div/div/main/div/div/div[2]/div[2]/div[4]/ul/li/span' ).text WriteExcel().write_excel_xls_append([ public_address_amount, public_address_hideen_amount, private_address_amount, private_address_hidden_amount, 'send public adress hidden amount: ' + str(rand) + 'TRY', public_address_amount2, public_address_hideen_amount2, private_address_amount2, private_address_hidden_amount2 ]) print('The account has been updated. Please check') break time.sleep(5) driver.quit()