Category Archives: Uncategorized

Using unmodifiable list Java 9

package test;package test; import java.util.Collections;import java.util.Iterator;import java.util.List; public class listtest { public static void main(String[] args) { // TODO Auto-generated method stub List im=List.of(“one”,”two”,”three”); List imlist=Collections.unmodifiableList(im); imlist.add(“four”); Iterator itr=imlist.iterator(); while(itr.hasNext()) { System.out.println(itr.next()); } } } In this case if you … Continue reading

Posted in Java, Uncategorized | Leave a comment

Using List.of Java 9

package test;package test; import java.util.Iterator;import java.util.List; public class ListTest { public static void main(String[] args) { List im=List.of(); Iterator itr=im.iterator(); while(itr.hasNext()) { System.out.println(itr.next()); } } }

Posted in Java, Uncategorized | Leave a comment

Open Browser using Python and without webdriver

import webbrowser webbrowser.open(‘https://www.google.com/’)

Posted in Python, Uncategorized | Leave a comment

Print Square root of Array using numpy

import numpy as np arr=np.array([5,10,15]) print(np.sqrt(arr))

Posted in Python, Uncategorized | Leave a comment

ChromeDriver error “unknown error: cannot get automation extension”

Use: ChromeOptions options = new ChromeOptions();ChromeOptions options = new ChromeOptions(); options.addArguments(“disable-infobars”); options.addArguments(“disable-extensions”);

Posted in Uncategorized | Leave a comment

Using Mockito and Testng in Java

I am using maven and have imported maven dependency for Mockito . import static org.mockito.Mockito.*; import java.util.List; import org.testng.annotations.Test; public class TestMockito { /** * Test Mockito using Java and TestNG. */ @Test public void testmock() { @SuppressWarnings(“unchecked”) List<String> list … Continue reading

Posted in Java, TestNG, Uncategorized | Leave a comment

Import Certificate

First get site certificate from Firefox. Open website then click the Lock icon on left hand side. Save the certificate locally. Then execute the below command: C:\Program Files\Java\jdk1.8.0_144\jre\lib\security>keytool -import -alias example -keystore cacerts -file staginglendingtreecom.crt Enter keystore password: Password is … Continue reading

Posted in Uncategorized | 1 Comment