Skip to content
Zurdi edited this page Sep 2, 2019 · 22 revisions

The NBZ was launched to provide a framework to automate web browsers to scrap or test any web page, based on selenium webdriver. This provides the user a higher level layer and a simpler way to create web testing scripts. Also, browsermob-proxy is implemented as proxy into NBZ to capture http requests.

NBZ is configured with nbz scripts.

IMPORTANT: Whenever you want to test into your own browser how a web page behaves to code your script, you must do it into incognito mode. Each script session is executed as if it were incognito mode, a totally new instance of the browser, cache, cookies, local storage and session storage.


Launching the NBZ

  • The launcher is the nbz.sh file

  • Options:

    • -h: Show this help
    • -v: Show the current version
    • -s: Set the .nbz script
    • -p: Set the script parameters (can be used multiple times)
    • -x: Enable screen emulation (server) / hide browser screen (desktop)
    • -r: Set custom resolution for screen emulation
    • -P: Enable proxy
    • -d: Enable debug mode; it is disabled by default
  • Scripts must have .nbz extension.

      $> ./nbz.sh -s /path/to/my_script.nbz
    
      $> ./nbz.sh -xs /path/to/my_script.nbz (-x is necesary to run it on server without graphic interface, or hide the browser window if it has graphic interface)
    
  • If you want to set some parameters to the script and use them into it, just use the -p option one or more times. Then in the .nbz script, use the get_parameter() function, with the index position of the parameter you want to load:

      $> ./nbz.sh -s /path/to/my_script.nbz -p "My parameter 1" -p "My parameter 2"
    
      # My awesome nbz script, with script parameters
    
      p0 = get_parameter(0);
      p1 = get_parameter(1);
    
      # -> p0 = "My parameter 0"
      # -> p1 = "My parameter 1"
    

Scripting on nbz

Scripting on nbz language is huge simple. It is a function based languaje. You can find the full documentation here.