Showing posts with label compile. Show all posts
Showing posts with label compile. Show all posts

Monday, 15 July 2013

Selenium test on CLI in 5 minutes using Java

This took me two weeks to nail down looking at it here and there.
  1. mkdir stests
  2. cd stests
  3. wget http://selenium.googlecode.com/files/selenium-java-2.33.0.zip
  4. unzip selenium-java-2.33.0.zip
  5. mkdir jars
  6. find selenium-2.33.0 -type f -name '*jar' -exec mv -v {} jars \;
  7. rm -rfv selenium-*
  8. mkdir src
  9. vi src/Test.java
    1. use below code
  10. mkdir out
  11. javac -d out -cp 'jars/*' src/MyTest.java
    1. ignore "Notes" output
  12. cd out
  13. rm -rfv org
  14. java -cp '../jars/*:.' MyTest

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

public class MyTest  {
    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.google.com");
        WebElement element = driver.findElement(By.name("q"));
        element.sendKeys("Cheese!");
        element.submit();
        System.out.println("Page title is: " + driver.getTitle());
        (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
            public Boolean apply(WebDriver d) {
                return d.getTitle().toLowerCase().startsWith("cheese!");
            }
        });
        System.out.println("Page title is: " + driver.getTitle());
        driver.quit();
    }
}

Wednesday, 3 April 2013

Build unbound from source on redhat/centos

NOTE: unbound is now available via epel repo on Amazon Linux
    1. install requirements
      1. yum groupinstall "Development Tools"
      2. yum install openssl-devel
      3. yum install expat-devel
    2. build
      1. ldns
        1. wget http://www.nlnetlabs.nl/downloads/ldns/ldns-1.6.16.tar.gz
        2. tar zxvf ldns-1.6.16.tar.gz
        3. cd ldns-1.6.16/
        4. ./configure --disable-gost --disable-ecdsa
        5. make
        6. make install
      2. unbound
        1. wget http://unbound.net/downloads/unbound-latest.tar.gz
        2. tar zxvf unbound-latest.tar.gz
        3. cd unbound-1.4.20/
        4. ./configure --disable-gost --disable-ecdsa
        5. make
        6. make install
    3. add libs to system lib path
      1. vi /etc/ld.so.conf.d/ldnsandunbound.conf
        1. add this one line
          1. /usr/local/lib
      2. sudo ldconfig
    4. add unbound user
      1. adduser --system unbound
    5. tweak config
      1. vi /usr/local/etc/unbound/unbound.conf
        1. see simple sample below
    6. run
      1. unbound
    7. check
      1. lsof -nP -i :53
    8. stop
      1. pkill unbound
    9. restart
      1. unbound
    server:
            verbosity: 1
            interface: 0.0.0.0
            access-control: 10.0.0.0/16 allow
    forward-zone:
           name: "my-vpc.internal"
           forward-addr: 252.252.199.199
           forward-first: no

    Taken: https://calomel.org/unbound_dns.html

    Interview questions: 2020-12

    Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...