Different refresh button in browsers

Different refresh button in browsers

Home Forums Ask Expert Different refresh button in browsers

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #32598
    Haydar Can Güngör
    Participant

      Hello,

      I’ve got the Problem, that i want to use the refresh button of the browsers, which i included like an image into my zaptest script. In my script i am using 3 different types of Browsers. Now the problem is, that all of these three have different images for the refresh button. It works only with one of these three browsers for me. Is it possible to solve that?

      Regards
      Guengoha

      #32601
      Sergey ZAP
      Keymaster

        Hello Guengoha,

        There are different ways to address this.
        1. If you have a parameter for browser type, you can use it in IF…ELSE block. You need separate objects for each Refresh button – you can scan different browsers using separate apps/views. You script may look like this:
        If Datatable.Value(“Browser”)=”ie” then
        Application(“Application_IE”).View(“View_IE”).Object(“Refresh”).Click
        Elseif Datatable.Value(“Browser”)=”chrome” then
        Application(“Application_CHROME”).View(“View_CHROME”).Object(“Refresh”).Click
        Elseif Datatable.Value(“Browser”)=”firefox” then
        Application(“Application_FIREFOX”).View(“View_FIREFOX”).Object(“Refresh”).Click
        end if

        2. If you are not using parameter for browser, you can perform simple check if Refresh object exists. You also need separate objects for each browser’s Refresh button.
        If Application(“Application_IE”).View(“View_IE”).Object(“Refresh”).Exist(5000,false) then
        Application(“Application_IE”).View(“View_IE”).Object(“Refresh”).Click
        Elseif Application(“Application_CHROME”).View(“View_CHROME”).Object(“Refresh”).Exist(5000,false) then
        Application(“Application_CHROME”).View(“View_CHROME”).Object(“Refresh”).Click
        Elseif Application(“Application_FIREFOX”).View(“View_FIREFOX”).Object(“Refresh”).Exist(5000,false) then
        Application(“Application_FIREFOX”).View(“View_FIREFOX”).Object(“Refresh”).Click
        end if

        3. Since most browsers use same key combination for reload (CTRL+R), you can use this code (should work for any browser):
        zap.Keyboard.KeyDown zap.Keys.Ctrl
        zap.Keyboard.KeyPress zap.Keys.R
        zap.Keyboard.KeyUp zap.Keys.Ctrl

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.

      Virtual Expert

      ZAPTEST

      ZAPTEST Logo