Is there anyway to automate actions with this page with headless selenium firefox?

63 views Asked by At

I was running scripts (automated payments) for the previous version of this portal

However, they changed the portal, and now whenever I try to go for example to the next screen with my script the page says that something went wrong. I assume it is because their website realizes that I run headless Mozilla and declines my query. Is there any way to bypass this? it saves me a lot of time to make payments automatically. I run the script with python selenium Mozilla. This is an example of the code

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    #
    import datetime
    import time
    import numpy as np
    import openpyxl
    import pyautogui
    import selenium
    from selenium import webdriver
    from selenium.webdriver.remote.webelement import WebElement
    from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.keys import Keys
    from selenium.common.exceptions import NoSuchElementException
    from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
    from pyvirtualdisplay import Display
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.firefox.options import Options
    from selenium.webdriver.firefox.webdriver import FirefoxProfile
    import keyboard
    import os
    import xlrd
    import shutil
    
    firefox_capabilities = DesiredCapabilities.FIREFOX
    firefox_capabilities['marionette'] = True
    
    driver = webdriver.Firefox(capabilities=firefox_capabilities)
        
    
    driver.get('https://ibank.nbg.gr/identity/login?ReturnUrl=https:%2F%2Fibank.nbg.gr%2Fidentity%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3D48423927-4F90-46A4-9F41-63A0B3114A92%26redirect_uri%3Dhttps%253A%252F%252Fibank.nbg.gr%252Fweb%252F%26response_mode%3Dform_post%26response_type%3Dcode%2520id_token%26scope%3Dopenid%2520role%2520ibank_profile%2520ibank-cards-api-v1%2520ibank-loans-api-v1%2520ibank-profile-api-v1%2520ibank-go4more-api-v1%2520ibank-billpayments-api-v1%2520ibank-accounts-api-v1%2520ibank-proxy-api-v1%26state%3DOpenIdConnect.AuthenticationProperties%253D3tP2ICLlQXSz7NC-pgLykBLQSVszlMygBdTcCup0TA-ySLABDDNKm9wC_IuN4PJe0gSdNCVrXDI1TskntUbdHl170X2d1AtIYYll4psfjgogqdnii7uGFeYY9DhAU5419o5lU_bmfm1L3QwzgJd78MtMooMTgF1Ancj6k8btGg7hGiYiKJF09rxhIE_BAni6rAkNA_tyvvHJhoz0l6C5Nw%26nonce%3D637350760833021182.MTQxMmQyYmItZDc2Zi00NmZiLTlmM2MtY2Q2YTAxY2RiN2RiN2Y5NDQyZjItYjZkOS00ODlhLTg1ODItNDk0YTNmZGNiNjFm%26x-client-SKU%3DID_NET451%26x-client-ver%3D5.2.1.0')
    driver.find_element_by_xpath('/html/body/index-page/div/login/div/div[1]/sign-in/sign-in-form/div/div/div/div[1]/div/input').send_keys(12345678)
    time.sleep(2)
    driver.find_element_by_xpath('/html/body/index-page/div/login/div/div[1]/sign-in/sign-in-form/div/div/div/div[2]/spinner/button').click()

Thank you in advance

0

There are 0 answers