top of page

Jmeter


var login = false
WDS.sampleResult.sampleStart()
var pkg = JavaImporter(org.openqa.selenium)


org.apache.jmeter.protocol.http.parser.RegexpHTMLPar
var robot = new java.awt.Robot()
var time = JavaImporter(java.util.concurrent.TimeUnit)
var email = WDS.args[0]
var link
var arraylink
var usertype
var TimeToWait 


 jmeter.reportgenerator.
   WDS.sampleResult.setSuccessful(false)
    WDS.sampleResult.setResponseMessage('Expected title to be Google')
        
     WDS.browser.get('http://www.fgh.htm')
     java.lang.Thread.sleep(5000)

     username =email
     
     if(username == 'student75' || username == 'NGUYEN.TRUNG')
    {
        WDS.log.info(username)
        usertype =1
        arraylink = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@id='ZCS2_SV']"))
    }
    if(username == 'HA.TRUC' || username == 'student74')
    {
        WDS.log.info(username)
        usertype=2
        arraylink = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@id='ZCS2_CON_OFF']"))
    }
    
    WDS.log.info("size size size  size size size size size size " + arraylink.size())

    
if (arraylink.size() == 0)
{    
    
    java.lang.Thread.sleep(5000)
    WDS.browser.findElement(pkg.By.xpath("//*[@id='sap-user']")).sendKeys(username)    
    WDS.browser.findElement(pkg.By.xpath("//*[@id='sap-password']")).sendKeys('init88')
    WDS.browser.findElement(pkg.By.xpath("//*[@id='b1']")).click()

    
    java.lang.Thread.sleep(5000)
}    

    if(usertype ==1)
    {
        link = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='ZCS2_SV']"))
    }
    if(usertype ==2)
    {
        link = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='ZCS2_CON_OFF']"))
    }

    
     link.click()

    WDS.log.info("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww")
    
    
    java.lang.Thread.sleep(5000)
    WDS.browser.switchTo().frame("CRMApplicationFrame")
    java.lang.Thread.sleep(5000)
    WDS.log.info("CRMApplicationFrame CRMApplicationFrame CRMApplicationFrame CRMApplicationFrame")
    
     var support_ui = WDS.browser.findElements(org.openqa.selenium.By.tagName("iframe")).size()
    WDS.log.info("111111111111111111111  " + support_ui)
    var vars = WDS.browser.findElements(org.openqa.selenium.By.tagName("iframe"))
    WDS.log.info(vars[2].getAttribute("id"))
    var frame2 = vars[2].getAttribute("id")
    WDS.browser.switchTo().frame(frame2)
    java.lang.Thread.sleep(2000)

    WDS.log.info("2222222222222222222222222222222222222222222222222222")
    var vars2  = WDS.browser.findElements(org.openqa.selenium.By.tagName("iframe"))
    WDS.log.info("zzzzzzzzzzzzzzzzzzzzzzzzzzzz" + vars2.size())
    var frame3 = vars2[0].getAttribute("id")
    WDS.browser.switchTo().frame(frame3)
    java.lang.Thread.sleep(2000)
    WDS.log.info("frame3 frame3 frame3       "  + frame3)
    

    java.lang.Thread.sleep(2000)
    WDS.log.info("44444444444444444444444444444444444444")
    var vars3  = WDS.browser.findElements(org.openqa.selenium.By.tagName("iframe"))
    WDS.log.info("zzzzzzzzzzzzzzzzzzzzzzzzzzzz" + vars3.size())
    var frame4 = vars3[0].getAttribute("id")
    WDS.browser.switchTo().frame(frame4)
    java.lang.Thread.sleep(2000)
    WDS.log.info("ssssssssssssssssssssssssssssssssss       "  + frame4)
    java.lang.Thread.sleep(2000)


    WDS.log.info("5555555555555555555555555555")
    var vars4 = WDS.browser.findElements(org.openqa.selenium.By.tagName("frame"))
    WDS.log.info("frame frame frame frame frame frame " + vars3.size())
    var frame5 = vars4[1].getAttribute("id")
    WDS.browser.switchTo().frame(frame5)
    java.lang.Thread.sleep(2000)
    WDS.log.info("ssssssssssssssssssssssssssssssssss       "  + frame5)
    java.lang.Thread.sleep(5000)

 

 

WDS.log.info(")/////////////////////////////////////////////////////////    Test 1  Service Request    //////////////////////////////////////////////////")
try {
    

        
        WDS.log.info( WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C12_W42_V43_SearchMenuAnchor1']/span/b")).getText())
        WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C12_W42_V43_SearchMenuAnchor1']/span/b")).click()
        
        var yy = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[contains(.,'All Objects')]"))
        WDS.log.info ('All Objects All Objects All Objects '  + yy.size())
        
            for (i = 0; i <= yy.size()-1; i++) {
                 WDS.log.info (yy[i].getText())
                 WDS.log.info (i)
                }
             yy[9].click()
        
        java.lang.Thread.sleep(5000)
          WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C13_W46_V47_SearchValue']")).sendKeys("smartcscrs@gmail.com")    
          java.lang.Thread.sleep(5000)
          var before = new Date().getTime()
        WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'QUICKSEARCH')]/span/b")).click()
        var SearchResult = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='bcTitle']/div")).getText()
        while (SearchResult != "Search Result") 
        {
            java.lang.Thread.sleep(1000)
            SearchResult = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='bcTitle']/div")).getText()
        }
        var after = new Date().getTime()
        
        WDS.log.info( username + ' Time taken = ' + (after - before) + ' ms')
        java.lang.Thread.sleep(22000) 
        
        if( (after - before) > 9000)
            {
                WDS.sampleResult.setSuccessful(false);
                WDS.log.error(username + " The search result teken " +  (after - before) + "ms")
                  WDS.sampleResult.setResponseMessage( username + " The search result teken " +  (after - before) + "ms")
            }
            else
            {
                WDS.sampleResult.setSuccessful(true);
                WDS.sampleResult.setResponseMessage(username + " The search result teken " +  (after - before) + "ms")
            }
}
catch(error) {
   WDS.log.error(username + " Eroor with Test 1  "  +  error)
}

WDS.log.info(")/////////////////////////////////////////////////////////    Test 2  Service Request    //////////////////////////////////////////////////")
try {
    

        
        WDS.log.info( WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C12_W42_V43_SearchMenuAnchor1']/span/b")).getText())
        WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C12_W42_V43_SearchMenuAnchor1']/span/b")).click()
        
        var yy = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[contains(.,'Service Requests')]"))
        WDS.log.info ('All Objects All Objects All Objects All Objects All Objects All Objects '  + yy.size())
        
            for (i = 0; i <= yy.size()-1; i++) {
                 WDS.log.info (yy[i].getText())
                 WDS.log.info (i)
                }

          // Scroll until that element is appeared on the page. 
            var actions = new org.openqa.selenium.interactions.Actions(WDS.browser)
          actions.moveToElement(yy[10]).perform()

          java.lang.Thread.sleep(5000)
          yy = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[contains(.,'Free Text')]"))
        WDS.log.info ('Free Text Free Text Free Text Free Text Free Text Free Text Free Text '  + yy.size())
        
            for (i = 0; i <= yy.size()-1; i++) {
                 WDS.log.info (yy[i].getText())
                 WDS.log.info (i)
                }
 
           yy[10].click()
          
        
        java.lang.Thread.sleep(5000)
        WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C13_W46_V47_SearchValue']")).clear()
          WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C13_W46_V47_SearchValue']")).sendKeys("Booking Create")    
          java.lang.Thread.sleep(5000)
          var before = new Date().getTime()
        WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'QUICKSEARCH')]/span/b")).click()
        var SearchResult = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='bcTitle']/div")).getText()
        while (SearchResult != "Search Result") 
        {
            java.lang.Thread.sleep(1000)
            SearchResult = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='bcTitle']/div")).getText()
        }
        var after = new Date().getTime()
        
        WDS.log.info( username + ' Time taken = ' + (after - before) + ' ms')
        java.lang.Thread.sleep(22000) 
        
        if( (after - before) > 9000)
            {
                WDS.sampleResult.setSuccessful(false);
                WDS.log.error(username + " The search result teken " +  (after - before) + "ms")
                  WDS.sampleResult.setResponseMessage( username + " The search result teken " +  (after - before) + "ms")
            }
            else
            {
                WDS.sampleResult.setSuccessful(true);
                WDS.sampleResult.setResponseMessage(username + " The search result teken " +  (after - before) + "ms")
            }
}
catch(error) {
   WDS.log.error(username + " Eroor with Test 2 "  +  error)
}


WDS.log.info(")/////////////////////////////////////////////////////////    Test 3  Service Request    //////////////////////////////////////////////////")
/////////////////////////////////////////////////////////    Test 3 //////////////////////////////////////////////////
try {
java.lang.Thread.sleep(5000)
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C4_W20_V21_ZSRSEARCH']")).click()
java.lang.Thread.sleep(10000)

WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C18_W56_V57_V58_search_parameters[7].VALUE1']")).click()
java.lang.Thread.sleep(2000)
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C18_W56_V57_V58_search_parameters[7].VALUE1__items']/ul/li[3]")).click()
java.lang.Thread.sleep(5000)


var before = new Date().getTime()
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C18_W56_V57_Searchbtn']/span/b")).click()

arraySearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@id='C1_W1_V2_C1_W1_V2_V3_C18_W56_V57_incidentviewset.do']/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[3]/table/tbody/tr/td[1]"))

while (arraySearchResult.size()==0) 
{
    java.lang.Thread.sleep(500)
    arraySearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@id='C1_W1_V2_C1_W1_V2_V3_C18_W56_V57_incidentviewset.do']/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[3]/table/tbody/tr/td[1]"))
    
}

 SearchResult = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C1_W1_V2_C1_W1_V2_V3_C18_W56_V57_incidentviewset.do']/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[3]/table/tbody/tr/td[1]")).getText()
var after = new Date().getTime()

java.lang.Thread.sleep(5000)

if( (after - before) > 9000)
    {
        WDS.sampleResult.setSuccessful(false)
        WDS.log.error(username +" The search result teken " +  (after - before) + "ms")
          WDS.sampleResult.setResponseMessage(username +" The search result teken " +  (after - before) + "ms")
    }
if( (after - before) < 9000)
    {
        WDS.sampleResult.setSuccessful(true)
        //WDS.sampleResult.setResponseMessageOK()
        WDS.log.info(username +" The search result teken " +  (after - before) + "ms")
        WDS.sampleResult.setResponseMessage( username +" The search result teken " +  (after - before) + "ms")
    }

}
catch(error) {
   WDS.log.error(username +" Eroor with Test 3  "  +  error)
}


//    Test 4  Service Request
try {

WDS.log.info("/////////////////////////////////////////////////////////    Test 4  Service Request    /////////////////////////////////////////////////")
    

WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C4_W20_V21_ZSRSEARCH']")).click()
java.lang.Thread.sleep(5000)

//press clear 
WDS.browser.findElement(org.openqa.selenium.By.xpath("//b[contains(text(),'Clear')]")).click()
java.lang.Thread.sleep(5000)
//email
var input_emails = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@title='Choose the value of criterion E-Mail Address']"))
input_emails[0].click()
input_emails[0].sendKeys('smartcscrs@gmail.com')
java.lang.Thread.sleep(5000)

// insert Time Frame
var TimeFrame = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[contains(@id, 'search_parameters[7]') and @class='th-as-val']"))
 TimeFrame[0].click()
java.lang.Thread.sleep(5000)
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id, 'search_parameters[7]')]/ul/li[6]/a")).click()
java.lang.Thread.sleep(5000)

var ServiceTeamNum = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@title='Choose the value of criterion Service Team']"))
ServiceTeamNum[0].clear()
java.lang.Thread.sleep(2000)
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id, 'search_max_hits')]")).clear()
java.lang.Thread.sleep(2000)
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id, 'search_max_hits')]")).sendKeys('50')
java.lang.Thread.sleep(2000)
var before = new Date().getTime()
WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='C18_W56_V57_Searchbtn']/span/b")).click()

SearchResult = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id, 'incidentviewset.do')]/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[3]/table//td[1]")).getText()

while (SearchResult.contains("Service Requests Found")!= true) 
{
     WDS.log.info(username +" Wait for results .... "  )
    java.lang.Thread.sleep(500)
     SearchResult = WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id, 'incidentviewset.do')]/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[3]/table//td[1]")).getText()
    
}

var after = new Date().getTime()

java.lang.Thread.sleep(5000)

if( (after - before) > 9000)
    {
        WDS.sampleResult.setSuccessful(false)
        WDS.log.error(username +" The search result teken " +  (after - before) + "ms")
          WDS.sampleResult.setResponseMessage( username +" The search result teken " +  (after - before) + "ms")
    }
if( (after - before) < 9000)
    {
        WDS.sampleResult.setSuccessful(true)
        //WDS.sampleResult.setResponseMessageOK()
        WDS.log.info(username +" The search result teken " +  (after - before) + "ms")
        WDS.sampleResult.setResponseMessage(username +" The search result teken " +  (after - before) + "ms")
    }

}
catch(error) {
   WDS.log.error(username +" Eroor with Test 4 " + error)
}


// ////   Test 5  edit SR
try {
    var sr_id=""
    WDS.log.info("/////////////////////////////////////////////////////////    Test 5  edit SR    //////////////////////////////////////////////////")
    java.lang.Thread.sleep(5000)
    var ArrayDescription = WDS.browser.findElements(org.openqa.selenium.By.xpath("//tbody/*[contains(@id, '_ResultTable__')]"))

    while ( ArrayDescription.size()<=0) 
    {
        WDS.log.info(username +" wait for results .... "  )
        java.lang.Thread.sleep(500)
         ArrayDescription = WDS.browser.findElements(org.openqa.selenium.By.xpath("//tbody/*[contains(@id, '_ResultTable__')]"))
         TimeToWait  = TimeToWait  + 500
         if (TimeToWait=10000 )
         {
             break
         }
              
    }

    
    WDS.log.info( "The search table contain " +  ArrayDescription.size() )
    for (i = 1; i <= ArrayDescription.size(); i++) {
         var PersonResponsible = WDS.browser.findElement(org.openqa.selenium.By.xpath("//tbody/*[contains(@id, '_ResultTable__')]["+ i +"]/td[5]")).getText()
          if(PersonResponsible.trim()==""){
              sr_id = WDS.browser.findElement(org.openqa.selenium.By.xpath("//tbody/tr["+ i +"][contains(@id, '_ResultTable__')]/td[2]/a")).getText()
              WDS.log.info(username +" SR_ID -PersonResponsible-" +  PersonResponsible.trim() +"-SR_ID-" + sr_id +"-" )
              WDS.browser.findElement(org.openqa.selenium.By.xpath("//tbody/tr["+ i +"][contains(@id, '_ResultTable__')]/td[2]/a")).click()
              break
            }
        }

 

    
    SearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@id='bcTitle']/div"))

    while (SearchResult[0].getText().contains(sr_id)!= true) 
    {
         WDS.log.info(username +"  wait for results .... "  )
        java.lang.Thread.sleep(500)
         SearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@id='bcTitle']/div"))
    }
    WDS.log.info(SearchResult[0].getText())
    java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*/td/input[contains(@id,'btcategoryfirst_cat02')]")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat02')]/ul/li[2]")).click()
    java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*/td/input[contains(@id,'btcategoryfirst_cat03')]")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat03')]/ul/li[2]")).click()

     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*/td/input[contains(@id,'btpartnerset_z')and contains(@id,'_name')]")).click()
    java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btpartnerset_z')and contains(@id,'_name__items') ]/ul/li[4]")).click()
    
     ///   save
     java.lang.Thread.sleep(5000)
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='th-l-toolbar']//*[contains(@id,'SAVE')]/span/b")).click()
 

    SearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath(    "//*[@id='CRMMessageLine1']/span[4]"))

    while (SearchResult[0].getText().contains("Service Requests Found")!= true) 
    {
         WDS.log.info(username +"  wait for results .... "  )
        java.lang.Thread.sleep(500)
         SearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@id='CRMMessageLine1']/span[4]")) 
    }
}
catch(error) {
   WDS.log.error("Eroor with Test 5  "  +  error)
}


//    Test 6  create SR
try {
    var sr_id=""
    WDS.log.info("/////////////////////////////////////////////////////////    Test 6  create SR    //////////////////////////////////////////////////")
    java.lang.Thread.sleep(5000)
    var ArrayDescription = WDS.browser.findElements(org.openqa.selenium.By.xpath("//tbody/*[contains(@id, '_ResultTable__')]"))
    WDS.log.info( "The search table contain " +  ArrayDescription.size() )
    for (i = 1; i <= ArrayDescription.size(); i++) {
         var PersonResponsible = WDS.browser.findElement(org.openqa.selenium.By.xpath("//tbody/*[contains(@id, '_ResultTable__')]["+ i +"]/td[5]")).getText()
          if(PersonResponsible.trim()==""){
              sr_id = WDS.browser.findElement(org.openqa.selenium.By.xpath("//tbody/*[contains(@id, '_ResultTable__')]["+ i +"]/td[2]")).getText()
              WDS.log.info(username +" SR_ID -PersonResponsible-" +  PersonResponsible.trim() +"-SR_ID-" + sr_id +"-" )
            }
        }
    WDS.browser.findElement(org.openqa.selenium.By.linkText("Create SR")).click()
    java.lang.Thread.sleep(5000)
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'description')]")).sendKeys('Jmeter')
     java.lang.Thread.sleep(5000)
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat01') and @readonly ='readonly']")).click()
    java.lang.Thread.sleep(5000)
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat01')]/ul/li[2]")).click()
    java.lang.Thread.sleep(5000)

     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat02') and @readonly ='readonly']")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat02')]/ul/li[2]")).click()
    java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat03') and @readonly ='readonly']")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat03')]/ul/li[2]")).click()

     ///  CUCC Name
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*/input[contains(@id,'customer_name')]")).sendKeys('GENERAL')
     //  Contact Name
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*/input[contains(@id,'tnerset_contact_name')]")).sendKeys('ayse aktas')
     // Company code:
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*/td/input[contains(@id,'ext.zzcomp_code')]")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'ext.zzcomp_code')]/ul/li[2]")).click()
     java.lang.Thread.sleep(5000)
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='th-l-toolbar']//*[contains(@id,'SAVE')]/span/b")).click()
 

    SearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath(    "//*[@id='CRMMessageLine1']/span[4]"))

    while (SearchResult[0].getText().contains("Service Requests Found")!= true) 
    {
         WDS.log.info(username + " wait for results .... "  )
        java.lang.Thread.sleep(500)
         SearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@id='CRMMessageLine1']/span[4]")) 
    }
}
catch(error) {
   WDS.log.error( username +" Eroor with Test 6  "  +  error)
}


//    Test 7 create SR
try {
    var sr_id=""
    WDS.log.info("/////////////////////////////////////////////////////////    Test 7 Inbox    //////////////////////////////////////////////////")
    java.lang.Thread.sleep(5000)
     WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@title='Inbox']")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@title='End']")).click()
     java.lang.Thread.sleep(5000)
      WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[contains(@id, 'thtmlbToggleSearchFields')]")).click()
      java.lang.Thread.sleep(5000)
      WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[contains(@id, 'search_max_hits')]")).clear()
      WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[contains(@id, 'search_max_hits')]")).sendKeys('200')
      java.lang.Thread.sleep(5000)
      WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[contains(@id, 'BtnSearch')]/span/b")).click()


    
    //-----------------------------------------------------
    var ArrayDescription = WDS.browser.findElements(org.openqa.selenium.By.xpath("//tbody/*[contains(@id, '_ResultTable__')]"))
    WDS.log.info( "The search table contain " +  ArrayDescription.size() )
    for (i = 1; i <= ArrayDescription.size(); i++) {
         var PersonResponsible = WDS.browser.findElement(org.openqa.selenium.By.xpath("//tbody/*[contains(@id, '_ResultTable__')]["+ i +"]/td[5]")).getText()
          if(PersonResponsible.trim()==""){
              sr_id = WDS.browser.findElement(org.openqa.selenium.By.xpath("//tbody/*[contains(@id, '_ResultTable__')]["+ i +"]/td[2]")).getText()
              WDS.log.info(username +" SR_ID -PersonResponsible-" +  PersonResponsible.trim() +"-SR_ID-" + sr_id +"-" )
            }
        }
    WDS.browser.findElement(org.openqa.selenium.By.linkText("Create SR")).click()
    java.lang.Thread.sleep(5000)
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'description')]")).sendKeys('Jmeter')
     java.lang.Thread.sleep(5000)
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat01') and @readonly ='readonly']")).click()
    java.lang.Thread.sleep(5000)
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat01')]/ul/li[2]")).click()
    java.lang.Thread.sleep(5000)

     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat02') and @readonly ='readonly']")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat02')]/ul/li[2]")).click()
    java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat03') and @readonly ='readonly']")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'btcategoryfirst_cat03')]/ul/li[2]")).click()

     ///  CUCC Name
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*/input[contains(@id,'customer_name')]")).sendKeys('GENERAL')
     //  Contact Name
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*/input[contains(@id,'tnerset_contact_name')]")).sendKeys('ayse aktas')
     // Company code:
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*/td/input[contains(@id,'ext.zzcomp_code')]")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[contains(@id,'ext.zzcomp_code')]/ul/li[2]")).click()
     java.lang.Thread.sleep(5000)
    WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='th-l-toolbar']//*[contains(@id,'SAVE')]/span/b")).click()
 

    SearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath(    "//*[@id='CRMMessageLine1']/span[4]"))

    while (SearchResult[0].getText().contains("Service Requests Found")!= true) 
    {
         WDS.log.info(username + " wait for results .... "  )
        java.lang.Thread.sleep(500)
         SearchResult = WDS.browser.findElements(org.openqa.selenium.By.xpath("//*[@id='CRMMessageLine1']/span[4]")) 
    }
}
catch(error) {
   WDS.log.error( username +" Eroor with Test 7 Inbox  "  +  error)
}

///    Close SAP 
try {
    WDS.log.info(")/////////////////////////////////////////////////////////    Close SAP    //////////////////////////////////////////////////")
     WDS.browser.switchTo().parentFrame();
     java.lang.Thread.sleep(35000)
     //WDS.log.info("5555555555555555555555555555   rollback to frame - " + frame4)
    var vars5 = WDS.browser.findElements(org.openqa.selenium.By.tagName("frame"))
    WDS.log.info("frame frame frame frame frame frame " + vars5.size())
    var frame6 = vars5[0].getAttribute("id")
    WDS.log.info("ssssssssssssssssssssssssssssssssss       "  + frame6)
    WDS.browser.switchTo().frame(frame6)
    java.lang.Thread.sleep(5000)
     WDS.browser.findElement(org.openqa.selenium.By.xpath("//*[@id='LOGOFF']")).click()
     java.lang.Thread.sleep(5000)
     WDS.browser.switchTo().alert().accept()
 }
catch(error) {
   WDS.log.info("Eroor with log out" + error)
}   
  
WDS.sampleResult.sampleEnd()
 

Selenium - izselenium aoutomation tool

054-8059589

  • White Facebook Icon
  • White Twitter Icon
  • White Google+ Icon
  • White YouTube Icon

© 2017 by izselenium

bottom of page