我正在为此门户的先前版本运行脚本(自动付款)
但是,他们更改了门户,现在每当我尝试使用我的脚本进入下一个屏幕时,页面都会显示出现问题。我认为这是因为他们的网站意识到我运行的是无头 Mozilla 并拒绝了我的查询。有没有办法绕过这个?自动付款为我节省了大量时间。我用 python selenium Mozilla 运行脚本。这是代码示例
#!/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()
先感谢您