SHARE
TWEET

Untitled

a guest Oct 4th, 2017 236 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2.     <!-- Copyright (c) 2011 Microsoft Corporation.  All rights reserved. -->
  3.     <!-- OwaPage = ASP.auth_logon_aspx -->
  4.     <!-- {57A118C6-2DA9-419d-BE9A-F92B0F9A418B} -->
  5.     <html xmlns="http://www.w3.org/1999/xhtml">
  6.      <head>
  7.       <meta http-equiv="X-UA-Compatible" content="IE=10" />
  8.       <link rel="shortcut icon" href="/owa/auth/15.0.1263/themes/resources/favicon.ico" type="image/x-icon" />
  9.       <meta http-equiv="Content-Type" content="text/html; CHARSET=utf-8" />
  10.       <meta name="Robots" content="NOINDEX, NOFOLLOW" />
  11.       <title>Outlook Web App</title>
  12.       <link type="text/css" rel="stylesheet" href="/owa/auth/15.0.1263/themes/resources/logon.css" />
  13.       <script type="text/javascript" src="/owa/auth/15.0.1263/scripts/premium/flogon.js"></script>
  14.       <script type="text/javascript">
  15.         <!--
  16.         var a_fRC = 1;
  17.         var g_fFcs = 1;
  18.         var a_fLOff = 0;
  19.         var a_fCAC = 0;
  20.         var a_fEnbSMm = 0;
  21.     /// <summary>
  22.     /// Is Mime Control installed?
  23.     /// </summary>
  24.     function IsMimeCtlInst(progid)
  25.     {
  26.         if (!a_fEnbSMm)
  27.             return false;
  28.  
  29.         var oMimeVer = null;
  30.  
  31.         try
  32.         {
  33.             // TODO: ingore this on none IE browser
  34.             //
  35.             //oMimeVer = new ActiveXObject(progid);
  36.         }
  37.         catch (e)
  38.         {
  39.         }
  40.  
  41.         if (oMimeVer != null)
  42.             return true;
  43.         else
  44.             return false;
  45.     }
  46.  
  47.         /// <summary>
  48.         /// Render out the S-MIME control if it is installed.
  49.         /// </summary>
  50.         function RndMimeCtl()
  51.         {
  52.             if (IsMimeCtlInst("MimeBhvr.MimeCtlVer"))
  53.                 RndMimeCtlHlpr("MimeNSe2k3", "D801B381-B81D-47a7-8EC4-EFC111666AC0", "MIMEe2k3", "mimeLogoffE2k3");
  54.  
  55.             if (IsMimeCtlInst("OwaSMime.MimeCtlVer"))
  56.                 RndMimeCtlHlpr("MimeNSe2k7sp1", "833aa5fb-7aca-4708-9d7b-c982bf57469a", "MIMEe2k7sp1", "mimeLogoffE2k7sp1");
  57.  
  58.             if (IsMimeCtlInst("OwaSMime2.MimeCtlVer"))
  59.                 RndMimeCtlHlpr("MimeNSe2k9", "4F40839A-C1E5-47E3-804D-A2A17F42DA21", "MIMEe2k9", "mimeLogoffE2k9");
  60.         }
  61.  
  62.         /// <summary>
  63.         /// Helper function to factor out the rendering of the S/MIME control.
  64.         /// </summary>
  65.         function RndMimeCtlHlpr(objid, classid, ns, id)
  66.         {
  67.             document.write("<OBJECT id='" + objid + "' classid='CLSID:" + classid + "'></OBJECT>");
  68.             document.write("<?IMPORT namespace='" + ns + "' implementation=#" + objid + ">");
  69.             document.write("<" + ns + ":Logoff id='" + id + "' style='display:none'/>");
  70.         }
  71.         -->
  72.  
  73.       </script>
  74.       <script>
  75.  
  76.             var mainLogonDiv = window.document.getElementById("mainLogonDiv");
  77.             var showPlaceholderText = false;
  78.             var mainLogonDivClassName = 'mouse';
  79.  
  80.             if (mainLogonDivClassName == "tnarrow") {
  81.                 showPlaceholderText = true;
  82.  
  83.                 // Output meta tag for viewport scaling
  84.                 document.write('<meta name="viewport" content="width = 320, initial-scale = 1.0, user-scalable = no" />');
  85.             }
  86.             else if (mainLogonDivClassName == "twide"){
  87.                 showPlaceholderText = true;
  88.             }
  89.  
  90.             function setPlaceholderText() {
  91.                 window.document.getElementById("username").placeholder = "user name";
  92.                 window.document.getElementById("password").placeholder = "password";
  93.                 window.document.getElementById("passwordText").placeholder = "password";
  94.             }
  95.  
  96.             function showPasswordClick() {
  97.                 var showPassword = window.document.getElementById("showPasswordCheck").checked;
  98.                 passwordElement = window.document.getElementById("password");
  99.                 passwordTextElement = window.document.getElementById("passwordText");
  100.                 if (showPassword)
  101.                 {
  102.                     passwordTextElement.value = passwordElement.value;
  103.                     passwordElement.style.display = "none";
  104.                     passwordTextElement.style.display = "inline";
  105.                     passwordTextElement.focus();
  106.                 }
  107.                 else
  108.                 {
  109.                     passwordElement.value = passwordTextElement.value;
  110.                     passwordTextElement.style.display = "none";
  111.                     passwordTextElement.value = "";
  112.                     passwordElement.style.display = "inline";
  113.                     passwordElement.focus();
  114.                 }
  115.             }
  116.  
  117.       </script>
  118.      </head>
  119.      <body class="signInBg" style="background: #f2f2f2 url('/owa/auth/15.0.1263/themes/resources/bg_gradient_login.png') repeat-x">
  120.       <script type="text/javascript">
  121.         RndMimeCtl();
  122.  
  123.       </script>
  124.       <noscript>
  125.         <div id="dvErr"> <table cellpadding="0" cellspacing="0"> <tr> <td> <img src="/owa/auth/15.0.1263/themes/base/warn.png" alt=""></td> <td style="width: 100%">To use Outlook Web App, browser settings must allow scripts to run. For information about how to allow scripts, consult the Help for your browser. If your browser doesn&#39;t support scripts, you can download <a href="http://www.microsoft.com/windows/ie/downloads/default.mspx">Windows Internet Explorer</a> for access to Outlook Web App.</td> </tr> </table> </div>
  126.       </noscript>
  127.       <form action="/owa/auth.owa" method="POST" name="logonForm" enctype="application/x-www-form-urlencoded" autocomplete="off">
  128.        <input type="hidden" name="destination" value="https://mail.cognizant.com/owa/" />
  129.        <input type="hidden" name="flags" value="0" />
  130.        <input type="hidden" name="forcedownlevel" value="0" />
  131.        <!-- Default to mouse class, so that things don't look wacky if the script somehow doesn't apply a class -->
  132.        <div id="mainLogonDiv" class="mouse">
  133.         <script>
  134.  
  135.                 var mainLogonDiv = window.document.getElementById("mainLogonDiv");
  136.                 mainLogonDiv.className = mainLogonDivClassName;
  137.  
  138.         </script>
  139.         <div class="logonContainer" style="padding-left: 300px; background-color: #3d5fa3; padding-top: 110px">
  140.          <div id="bglogodiv" style="background-image: url(15.0.847/themes/resources/ctslogo.jpg); border-radius: 25px; width: 800px">
  141.           <br />
  142.           <br />
  143.           <div id="lgnDiv" class="logonDiv" onkeypress="return checkSubmit(event)">
  144.            <div class="signInImageHeader" role="heading" aria-label="Outlook Web App ">
  145.             <img class="mouseHeader" src="/owa/auth/15.0.1263/themes/resources/owa_text_blue.png" alt="Outlook Web App " />
  146.            </div>
  147.            <div>
  148.             <div id="right" style="width: auto; float: right">
  149.              <div class="signInInputLabel" id="userNameLabel" aria-hidden="true">
  150.               User name:
  151.              </div>
  152.              <div>
  153.               <input id="username" name="username" class="signInInputText" role="textbox" aria-labelledby="userNameLabel" />
  154.              </div>
  155.              <div class="signInInputLabel" id="passwordLabel" aria-hidden="true">
  156.               Password:
  157.              </div>
  158.              <div>
  159.               <input id="password" onfocus="g_fFcs=0" name="password" value="" type="password" class="signInInputText" aria-labelledby="passwordLabel" />
  160.              </div>
  161.              <div>
  162.               <input id="passwordText" onfocus="g_fFcs=0" name="passwordText" value="" style="display: none;" class="signInInputText" aria-labelledby="passwordLabel" />
  163.              </div>
  164.              <div class="showPasswordCheck signInCheckBoxText">
  165.               <input type="checkbox" id="showPasswordCheck" class="chk" onclick="showPasswordClick()" />
  166.               <span>Show password</span>
  167.              </div>
  168.             </div>
  169.             <div id="middle" style="width: 1px; float: right; padding-right:130px;">
  170.              <img src="15.0.847/themes/resources/lgntopm99.png" height="100" width="1" />
  171.             </div>
  172.             <div id="left" style="width: auto; float: left">
  173.              <div>
  174.               <p style="font-family: 'Segoe UI'; font-size: 14px; text-align: left"> Users other than APAC <br /> Click your respective location : <br /> <br /> <a href="https://usmail.cognizant.com/owa"><b>America & Europe Users </b></a> <br /> <a href="https://outlook.com/owa/cognizant.com"><b>O365 Users </b></a> <br /> <a href="http://gapps.cognizant.com"><b>GApps Users </b></a> </p>
  175.              </div>
  176.             </div>
  177.            </div>
  178.            <br style="clear: both;" />
  179.           </div>
  180.           <div class="signInCheckBoxText">
  181.            <input id="chkPrvt" onclick="clkSec()" name="trusted" value="4" type="checkbox" class="chk" role="checkbox" aria-labelledby="privateLabel" />
  182.            <span id="privateLabel" aria-hidden="true">Private computer</span> ?(
  183.            <a href="#" class="signInCheckBoxLink" id="lnkShwSec" onclick="clkSecExp('lnkShwSec')" onkeydown="kdSecExp('lnkShwSec')" role="link">What is this?</a>
  184.            <a href="#" class="signInCheckBoxLink" id="lnkHdSec" onclick="clkSecExp('lnkHdSec')" onkeydown="kdSecExp('lnkHdSec')" style="display: none" role="link"> Hide explanation </a> )?
  185.           </div>
  186.           <div id="prvtExp" class="signInExpl" style="display: none" role="note">
  187.            Select this option if you're the only person who uses this computer. Your server will allow a longer period of inactivity before signing you out.
  188.           </div>
  189.           <div id="prvtWrn" class="signInWarning" style="display: none" role="note">
  190.            Warning: By selecting this option, you confirm that this computer complies with your organization's security policy.
  191.           </div>
  192.           <div class="signInCheckBoxText">
  193.            <input id="chkBsc" type="checkbox" onclick="clkBsc();" class="chk" role="checkbox" aria-labelledby="lightLabel" />
  194.            <span id="lightLabel" aria-hidden="true">Use the light version of Outlook Web App</span>
  195.           </div>
  196.           <div id="bscExp" class="signInExpl" style="display: none" role="note">
  197.            The light version of Outlook Web App includes fewer features. Use it if you're on a slow connection or using a computer with unusually strict browser security settings. We also support the full Outlook Web App experience on some browsers on Windows, Mac, and Linux computers. To check out all the supported browsers and operating systems,
  198.            <a class="signInCheckBoxLink" href="http://office.com/redir/HA102824601.aspx" id="bscLnk">click here.</a>
  199.           </div>
  200.           <div class="signInEnter">
  201.            <div onclick="clkLgn()" class="signinbutton" role="button" tabindex="0">
  202.             <img class="imgLnk" src="/owa/auth/15.0.1263/themes/resources/Sign_in_arrow.png" alt="" />
  203.             <span class="signinTxt">sign in</span>
  204.            </div>
  205.            <input name="isUtf8" value="1" type="hidden" />
  206.           </div>
  207.           <div class="hidden-submit">
  208.            <input type="submit" tabindex="-1" />
  209.           </div>
  210.           <div id="expltxt" class="signInExpl" role="alert">
  211.           </div>
  212.           <div style="border-radius: 25px; width: 600px; padding-left: 100px; padding-right: 200px;">
  213.            <p style="color: #444444; font-family: 'Segoe UI'; font-size: 12px; text-align: left"> To protect your account from unauthorized access, Outlook Web Access automatically closes its connection to your mailbox after a period of inactivity. If your session ends, refresh your browser, and then log on again. <br /> <br /> <b>Having trouble logging on?</b> <br /> Please contact the Cognizant Global Service Desk : <br /> VNet- 56666 <br /> India - 1800-2000-473 (Toll Free) <br /> US - 1-866-822-2024 <br /> UK - 0-800-678-1616 <br /> <br /> <a href="https://gsdonline.cognizant.com/new/selfhelp-updated/owafaq.asp">FAQ</a> </p>
  214.            <img src="15.0.847/themes/resources/footerimgowa.png" />
  215.            <p style="font-family: 'Segoe UI'; font-size: 8px"> </p>
  216.           </div>
  217.          </div>
  218.          <div id="cookieMsg" class="logonDiv" style="display: none">
  219.           <div class="signInHeader">
  220.            Outlook Web App
  221.           </div>
  222.           <div class="signInExpl">
  223.             Please enable cookies for this Web site.
  224.            <br />
  225.            <br />Cookies are currently disabled by your browser. Outlook Web App requires that cookies be enabled.
  226.            <br />
  227.            <br />For information about how to enable cookies, see the Help for your Web browser.
  228.            <br />
  229.            <br />
  230.            <br />
  231.           </div>
  232.           <div class="signInEnter">
  233.            <div onclick="clkRtry()" style="cursor: pointer; display: inline">
  234.             <img class="imgLnk" src="/owa/auth/15.0.1263/themes/resources/Sign_in_arrow.png" alt="" />
  235.             <span class="signinTxt" tabindex="0">retry</span>
  236.            </div>
  237.           </div>
  238.          </div>
  239.         </div>
  240.        </div>
  241.       </form>
  242.       <script>
  243.         if (showPlaceholderText) {
  244.             setPlaceholderText();
  245.         }
  246.  
  247.       </script>
  248.      </body>
  249.     </html>
  250.    
  251. import java.util.List;
  252. import java.util.concurrent.TimeUnit;
  253.  
  254. import org.jsoup.Jsoup;
  255. import org.jsoup.nodes.Element;
  256. import org.jsoup.select.Elements;
  257. import org.junit.Assert;
  258. import org.openqa.selenium.By;
  259. import org.openqa.selenium.WebDriver;
  260. import org.openqa.selenium.WebElement;
  261. import org.openqa.selenium.chrome.ChromeDriver;
  262. import org.w3c.dom.Document;
  263.  
  264.  
  265. public class Dynamic_LoginPass {
  266.  
  267.     public static final String Username = "admin";
  268.  
  269.     public static final String Password = "admin";
  270.  
  271.     public static void main(String[] args) throws InterruptedException {
  272.         // TODO Auto-generated method stub
  273.         System.setProperty("webdriver.chrome.driver","D:\Eclipse\workspace\PopUp_Test\lib\chromedriver.exe");
  274.  
  275.  
  276.         WebDriver driver = new ChromeDriver();
  277.         driver.manage().window().maximize();
  278.  
  279.         driver.get("https://www.nature.com/");
  280.          try {
  281.                 TimeUnit.SECONDS.sleep(5);
  282.             } catch (InterruptedException e) {
  283.                 e.printStackTrace();
  284.             }
  285.             String windowHandle = driver.getWindowHandle();
  286.             Assert.assertNotNull(windowHandle);
  287.  
  288.         Thread.sleep(10000);
  289.  
  290.         //driver.findElement(By.xpath("//*[@id="easycont"]/div/div[2]/div[2]/div[2]/button")).click();
  291.         String html_content1 = driver.getPageSource();
  292.  
  293.  
  294.          // Jsoup makes DOM here by parsing HTML content
  295.          org.jsoup.nodes.Document doc1 = Jsoup.parse(html_content1);
  296.          System.out.println("Result:"+doc1);
  297.  
  298.          int test= doc1.select("div:contains(signInInputLabel)").size();
  299.          System.out.println("testtesttesttest::"+test);
  300.  
  301.             if(driver.findElement(By.cssSelector("input[id=username]")) != null){    
  302.                 driver.findElement(By.cssSelector("input[id=username]")).sendKeys(Username);
  303.                 driver.findElement(By.cssSelector("input[id=password]")).sendKeys(Password);
  304.                 driver.findElement(By.xpath("//*[@id="bglogodiv"]/div[7]/div/span")).click();
  305.                 System.out.println("#############clicked################");
  306.             } else if(driver.findElement(By.cssSelector("input[id=password]")) != null){
  307.  
  308.                 System.out.println("clicked in else if");  
  309.             }    
  310.  
  311.         /*
  312.          WebElement Email = driver.findElement(By.cssSelector("input[id=username]"));
  313.          Email.sendKeys(Username);
  314.          WebElement Email1 = driver.findElement(By.cssSelector("input[id=password]"));
  315.          Email1.sendKeys(Password);
  316.          //driver.findElement(By.cssSelector("input[type='submit']")).click();
  317.          List<WebElement> checks =  driver.findElements(By.className("signInEnter"));
  318.         // click the 3rd checkbox
  319.         checks.get(1).click();*/
  320.  
  321.          //driver.close();
  322.     }
  323. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top