2017-10-09 60 views
-1

網頁包含一個彈出窗口,彈出窗口中有<'object'>,通過顯示另一個網站內容的對象彈出窗口。在這裏,在該網站內容中,我無法使用硒將數據輸入到登錄字段。 爲同一請在這裏找到完整的HTML代碼,請幫我提供此無法訪問硒中的<object>標記中的元素

<div class="documentViewPopUp extrasPopUp" style> 
    <span style="kljhgjk ghjkljhg0"> 
    <div id="popContainer" class="popContainer" align ="center"> 
     <div class="row">.....</div> 
     <div class="row"> 
      ::before 
      <div class="col-md-20 col-xs-20"> 
       <div id="dc"> 
        <object data="http://80.80.80.80/ExternalService?RequestCode=ABCDEF34GH" id="ABCSLinkAppID" 
         class="col-md-30 col-md-offset-1 col-xs-30" height="800" type="text/html"> Alternative Content </object> 
         #document 
          <!DOCTYPE html> 
           <html class="robapp-html" lang="en" data-media-queries="enabled"> 
           <head>...........</head> 
           <body class="abc widget"> 
           <script type="text/javascript">......</script> 
           <div id="load" class="load">...</div> 
           <script type="text/javascript">.....</script> 
           <script type="text/javascript" src=""></script> 
           <div id="reelFeedBack" class="hide toast-message feedback-wrapper">.....</div> 

           <div id="modelInfo" class="hide toast-message none feedback-wrapper">......</div> 
           <div id="main-container" class="desktop-device module_10003600 gc multi-account" style="height: 800px; top: 0px;"> 
            <div class="gcContainer FL addMinHeight"> 
             <!-- head starts here --> 
            <div class="ada-offscreen adaScreenLoadMsgFL" tabindex="0">.....</div> 
             <!-- Header --> 
            <div class="header row collapse headerTitle fixedHeader">.......</div> 
             <!-- Header ends here --> 
             <!-- Content body start here --> 
            <div class="rwWrapper row full-page mainBody contentScroll" style="max-height: 704px; min-height: 554px;"> 
             ::before 
             <div id="twinnerWrapper"></div> 
             <div id="messageWrapper" class="small-plus-wrapper"></div> 
             <!-- -Splash page holder--> 
             <div id="splashPage" class="mobileContainer"></div> 
             <!-- Dummy region to aviod error--> 
             <div id="leftContent" class="panel card" style="display:none;"></div> 
             <!-- New theme wrapper --> 
             <div class="row collapse small-plus-wrapper" id="main-wapper">   
              ::before 
              <!-- Left section holder --> 
              <div class="full-page full-view full-view-bottom small-12" id="left-section"> 
               <div id="rightContent" class="panel card"> 
                <div id="main-container_panel_0" class="panel sub-panel active"> 
                 <div class="cardContainer"> 
                  <div id="main-container_panel_0_bodyContent" class="bodyContent desktop-device module_10003592 gc"> 
                   <div class="site-form"> 
                    <div class="mfawrapper-full-view full-view-bottom "> 
                     <div class=" row small-12">....</div> 
                     <div class="row collapse"> 
                      ::before 
                      <div class="small-12 columns small-centered medium-8 smallplusbox">  
                       <div class="squareWrapperSmallplus active no-border-for-mobile-only"> 
                        <div class="section-title show-for-smallplus-only " role="heading" aria-level="2">LOG IN TO YOUR ACCOUNT</div> 
                         <div id="thinplusHeader" class=" siteLogoWrapper show-for-medium-down hide-for-medium-only ">.....</div> 
                         <div class="sdhelpText show-for-medium-down hide-for-medium-only hide-for-smallplus-only ">......</div> 
                         <div class="mobile-wrapper"> 
                          <div id="ddcontent"> 
                           <div> 
                            <div class> 
                             <div class="row collapse row medium-7 ">.....</div> 
                             <!-- end of global error message --> 
                             <!-- Form display --> 
                              <form autocomplete="off" class=" row medium-7 with-form-fields "> 
                               <div class="sdloginForm"> 
                                <div class="row collapse " id="row_LOGIN"> 
                                 ::before 
                                 <div class="small-12 column end">....</div> 
                                 <div class="small-12 column end"> 
                                  <input type="text" name="LOGIN" id="UserLOGIN" maxlength="40" class="formField input-error-field 
                                  star_field" autocomplete="off" autocapitalize="off" autocorrect="off" spellcheck="false" placeholder="Catalog " 
                                  aria-label="Catalog " value=""> 
                                 </div> 

的可能的解決方案,也請看下面是我的硒代碼。使用上面的代碼

wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("extrasPopUp"))); 
Sleeper.sleepTightInSeconds(15); 
driver.switchTo().frame("ABCSLinkAppID"); 
driver.findElement(By.id("UserLOGIN")).sendKeys("emma"); 

// to get # of fields in the Object Content 
List<WebElement>fields=driver.findElements(By.tagName("input")); 
System.out.println(fields.size()); 

,我無法切換到對象的內容和 收到錯誤爲「通過發現無邊框元素名稱或ID ABCSLinkAppID」

+0

請粘貼特定的HTML和問題 – iamsankalp89

+1

@ iamsankalp89,不要試圖回答每一件事。不知道我問了什麼,你怎麼能低估我的問題。如果你沒有足夠的時間回答問題,請不要回答或不做任何事情。 –

+0

我不是downvoted,其次你的問題沒有清除 – iamsankalp89

回答

0

爲什麼不使用你的元素聲明的XPath?

//objectx0020data[@id='ABCSLinkAppID'] 

x0020是XML中的空間代碼。使用此代替只有ID。