zabbix_export:
  version: '7.0'
  host_groups:
    - uuid: 748ad4d098d447d492bb935c907f652f
      name: Databases
  hosts:
    - host: 'Server crash on invalid method'
      name: 'Server crash on invalid method'
      status: DISABLED
      groups:
        - name: Databases
      interfaces:
        - interface_ref: if1
      items:
        - name: 'Login to zabbix and open host list'
          type: BROWSER
          key: login.item
          trends: '0'
          value_type: TEXT
          params: |
            var browser, result, screenshot, count;
            var opts = Browser.chromeOptions();
            opts.capabilities.alwaysMatch['goog:chromeOptions'].args = [];
            var browser = new Browser(opts); 
            // browser = new Browser(Browser.chromeOptions());
             
            try {
                browser.navigate("http://192.168.88.41/zbx-24473-6.5/zabbix.php?action=host.list");
                browser.collectPerfEntries("open page");
            
                var el = browser.findElement("xpath", "//button[@id='login']");
                if (el === null) {
                    throw Error("cannot find login button");
                }
                el.click();
            
                el = browser.findElement("xpath", "//input[@id='name']");
                if (el === null) {
                    throw Error("cannot find name input field");
                }
                el.sendKeys("Admin");
             
                el = browser.findElement("xpath", "//input[@id='password']");
                if (el === null) {
                    throw Error("cannot find password input field");
                }
                el.sendKeys("zabbix");
             
                el = browser.findElement("xpath", "//button[@id='enter']");
                if (el === null) {
                    throw Error("cannot find login button");
                }
                el.click();
            screenshot = browser.getScreenshot(); 
            
               count = browser.findElements("text", "Web").count();
            
                browser.collectPerfEntries("login");
               
                el = browser.findElement("link text", "Sign out");
                if (el === null) {
                    throw Error("cannot find logout button");
                }
                el.click();
            
                browser.collectPerfEntries("logout");
            
            result = browser.getResult();
            result.screenshot = screenshot;
            }
            catch (err) {
                if (!(err instanceof BrowserError)) {
                    browser.setError(err.message);
                }
                result = browser.getResult();
                result.error.screenshot = browser.getScreenshot();
            }
            finally {
                return JSON.stringify(result);
            }
      inventory_mode: DISABLED