1

first of all i wanted to say that im quite new to python and selenium in particular. Me and a co-worker are trying to automate a web app to sort payments for us. everything works up to the part where a pop window appears.This pop up basically its a credit card form.

The Issue is: You can only interact with the fields, the two buttons and you can close it using the "X". you cant inspect with developer tools, and i cant download any other programs for that because its a work computer.

the things i found so far are the link as you can see in the address bar, and i was able to inspect it with the developer tools 'Network' tab.

here is the code that is in the window:

  <html>
  <head>
  <title> ÷ìéèú ôøèé àùøàé </title>
  </head>
  <body>
  <BR>
  <iframe id="iFrame" width="100%" height="100%" src="" frameborder="0" ></iframe> 
   <script Language="JavaScript">
  if (typeof(window.dialogArguments)!="undefined") document.getElementById('iFrame').src = window.dialogArguments;
  </script>
  </body>
  </html>

the following is the code which sits inside the page itself (the input fields etc.):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<script src="merchantPages/WebSources/js/HE.js"></script>
<script src="merchantPages/leaseacar/js/main.js"></script>
<script src="merchantPages/leaseacar/js/tafnitTrack2.js"></script>
<link href="merchantPages/WebSources/css/main.rtl.css" rel="stylesheet" type="text/css" />

<title>דף תשלום מאובטח</title>
</head>
<body onload="resetForm();">



<!--  DISPLAY TRANSACTION INFORMATION -->
<div id="main_frame" align="center">
<div id="main">
    <div id="page_title"><img id="ssl_logo" src="merchantPages/WebSources/images/ssl.png" alt="" title=""/><h1>דף תשלום מאובטח</h1></div>
    <div id="logo"><img src="merchantPages/leaseacar/images/eTafnit.gif" alt="" title="" width="87" height="118"/></div>
    <div class="sep"></div>
    <div id="page_desc">
        <em>עמוד זה הינו עמוד התשלום עבור העסקה שביצעת באתר.<br />תשלום בעבור ההזמנה יבוצע רק לאחר בחירה בכפתור "שליחה" שבתחתית המסך.<br />אנא אשר תחילה כי כל הפרטים בדף זה נכונים והזן את פרטי כרטיס האשראי כנדרש.</em>
    </div>
    <form id="creditForm" onsubmit="return formValidator(10);" method="POST" action="ProcessCreditCard">
    <input type="hidden" name="txId" value="0ce8b10c&#45;2550&#45;4293&#45;ac6b&#45;fee0b61c5b80"/>
    <input type="hidden" name="lang" value="HE"/>
    <input type="hidden" name="last4d" value="" autocomplete="off" />
    <input type="hidden" name="cavv" value="" autocomplete="off" />
    <input type="hidden" name="eci" value="" autocomplete="off" />
    <input type="hidden" name="transactionCode" value="Phone" autocomplete="off" />
    <input type="hidden" name="expMonth" value="10" autocomplete="off" />
    <input type="hidden" name="expYear" value="24" autocomplete="off" />
    <input type="hidden" name="personalId" value="" autocomplete="off" />
    <input type="hidden" name="userData1" value=""/>
    <input type="hidden" name="userData2" value=""/>
    <input type="hidden" name="userData3" value=""/>
    <input type="hidden" name="userData4" value=""/>
    <input type="hidden" name="userData5" value=""/>
    <input type="hidden" name="userData6" value=""/>
    <input type="hidden" name="userData7" value=""/>
    <input type="hidden" name="userData8" value=""/>
    <input type="hidden" name="userData9" value=""/>
    <input type="hidden" name="userData10" value=""/>

    <table class="data_tbl">
        <thead>
            <td colspan="4" class="td_style_1">הזנת פרטי כרטיס אשראי לתשלום</td>
        </thead>
        <tr>
            <td class="td_style_fieldName">Card Number:</td>
            <td><input type="text" id="cardNumber" name="cardNumber" maxlength="19" 
style="width: 160px;" autocomplete="off" onchange="validateCardNumber();"/></td>
            <td class="td_style_invalidField" id="invalidCardNumber">&nbsp;</td>
        </tr>
        <tr>
            <td class="td_style_fieldName">CVV:</td>
            <td><input type="text" name="cvv" id="cvv" maxlength="4" style="width: 50px;" autocomplete="off" onchange="validateCvv();"/>  <img src="merchantPages/WebSources/images/qm.png"  onmouseover="showHideCVVhelp();" onmouseout="showHideCVVhelp();" style="cursor:pointer;"/><div id="CVVhelp" style="display: none; position: absolute; border: 1px #cccccc solid; padding: 10px; background: white;"><img src="merchantPages/WebSources/images/cvv.jpg" /></div></td>
            <td class="td_style_invalidField" id="invalidCvv">&nbsp;</td>
        </tr>
        <tr>
            <td class="td_style_fieldName">Track2:</td>
            <td><input type="password" name="track2" id="track2" value="" autocomplete="off" onchange="tafnitValidateTrack2();"/></td>
            <td class="td_style_invalidField" id="invalidTrack2">&nbsp;</td>
        </tr>
    </table>
    <div id="form_buttons"><input type="submit" id="submitBtn" value="שליחה" /> | <input id="resetBtn" type="reset" value="ניקוי" /></div>
    </form>
</div>
<br />
<img src="merchantPages/WebSources/images/rapidssl.gif" alt="" title=""/>
</div>
</body>

</html>

if someone could give me some advice on how could i target the window so i can close, or if its even possible.

this is what i got so far:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.alert import Alert
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time
#IMPORTS!-------------------------------------

usr = "***"
pwd = "***"
#app.
driver = webdriver.Ie(executable_path='C:/Users/natbag/Desktop/proj/IEDriverServer.exe')
driver.get('http://111.10.10.10/MENU1/LOGIN7.CSP')
driver.implicitly_wait(10)
username_box = driver.find_element_by_id('Username')
username_box.clear()
username_box.send_keys(usr)

password_box = driver.find_element_by_id('Password')
password_box.send_keys(pwd)

login_btn = driver.find_element_by_xpath('//input[@type="submit"]').click()

#------------------------End of Login ------------------------------------

#update contract page ----------
upd_con = driver.find_element_by_partial_link_text('עדכון חוזה').click()
#input latest Contract (F7) ----
input_con = driver.find_element_by_id('HOZ').send_keys(Keys.F7)
#goto receipts --------
receipts_btn = driver.find_element_by_xpath('//input[@name="BKBL"]').click()
Alert(driver).accept()
#input employee name ----- F7 for now later can be changed for custom number -----
work_name = driver.find_element_by_xpath('//input[@name="OVED"]').send_keys(Keys.F7)
#Receipts after username --------------------
receipts_btkn = driver.find_element_by_xpath('//input[@name="BTKBL"]').click()
#2 Seconds SLEEP IS MANDATORY!!! ----
#select Credit Card by Last Value (F7) can be changed to custom value
cc = driver.find_element_by_id('KSM').send_keys(Keys.F7)
#-------------- CANT INTERACT WITH CC WINDOW -----------------
WebDriverWait(driver, 5).until(EC.frame_to_be_available_and_switch_to_it((driver.find_element_by_xpath('//iframe[@id"iFrame"]'))))
#WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@type='text'] and [@id='cvv']"))).click()

sorry for the long post,

thanks in advance

1 Answers1

0

Well i figured it out using pyautogui.

tnx everyone