chiwormjava 1.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/java.json +35 -50
  2. package/package.json +1 -1
  3. package/readme.md +1263 -114
package/java.json CHANGED
@@ -1,54 +1,4 @@
1
1
  {
2
- "linkedlist": {
3
- "title": "Linked List",
4
- "code": "class Outer{\\n\\tclass LinkedList{\\n\\t\\tclass Node{\\n\\t\\t\\tint data;\\n\\t\\t\\tNode next;\\n\\n\\t\\t\\tNode(int data){\\n\\t\\t\\t\\tthis.data = data;\\n\\t\\t\\t}\\n\\t\\t}\\n\\n\\t\\tNode head = null;\\n\\n\\t\\tvoid add(int data){\\n\\t\\t\\tNode n = new Node(data);\\n\\n\\t\\t\\tif(head == null){\\n\\t\\t\\t\\thead = n;\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\n\\t\\t\\tNode temp = head;\\n\\t\\t\\twhile(temp.next != null){\\n\\t\\t\\t\\ttemp = temp.next;\\n\\t\\t\\t}\\n\\n\\t\\t\\ttemp.next = n;\\n\\t\\t}\\n\\n\\t\\tvoid remove(int data){\\n\\t\\t\\tif(head == null) return;\\n\\n\\t\\t\\tif(head.data == data){\\n\\t\\t\\t\\thead = head.next;\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\n\\t\\t\\tNode temp = head;\\n\\t\\t\\twhile (temp.next != null){\\n\\t\\t\\t\\tif(temp.next.data == data){\\n\\t\\t\\t\\t\\ttemp.next = temp.next.next;\\n\\t\\t\\t\\t\\treturn;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\ttemp = temp.next;\\n\\t\\t\\t}\\n\\t\\t}\\n\\n\\t\\tvoid display(){\\n\\t\\t\\tNode temp = head;\\n\\t\\t\\twhile(temp != null){\\n\\t\\t\\t\\tSystem.out.println(temp.data + \\\" \\\" );\\n\\t\\t\\t\\ttemp = temp.next;\\n\\t\\t\\t}\\n\\t\\t\\tSystem.out.println();\\n\\t\\t}\\n\\t}\\n\\n\\tpublic static void main(String []args){\\n\\t\\tOuter o = new Outer();\\n\\t\\tLinkedList list = o.new LinkedList();\\n\\n\\t\\tlist.add(1);\\n\\t\\tlist.add(2);\\n\\t\\tlist.add(3);\\n\\n\\t\\tlist.display();\\n\\n\\t\\tlist.remove(2);\\n\\n\\t\\tlist.display();\\n\\t}\\n}"
5
- },
6
-
7
- "springboot_hello": {
8
- "title": "Spring Boot Hello API",
9
- "code": "package com.example.demo;\\n\\nimport org.springframework.boot.SpringApplication;\\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\\nimport org.springframework.web.bind.annotation.GetMapping;\\nimport org.springframework.web.bind.annotation.RestController;\\n\\n@SpringBootApplication\\npublic class DemoApplication {\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tSpringApplication.run(DemoApplication.class, args);\\n\\t}\\n}\\n\\n@RestController\\nclass HelloController {\\n\\n\\t@GetMapping(\\\"/hello\\\")\\n\\tpublic String sayHello() {\\n\\t\\treturn \\\"Hello From Developer...!!!\\\";\\n\\t}\\n}"
10
- },
11
-
12
- "springboot_calculator": {
13
- "title": "Spring Boot Calculator API",
14
- "code": "package com.example.demo;\\n\\nimport org.springframework.boot.SpringApplication;\\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\\nimport org.springframework.web.bind.annotation.GetMapping;\\nimport org.springframework.web.bind.annotation.RequestParam;\\nimport org.springframework.web.bind.annotation.RestController;\\n\\n@SpringBootApplication\\npublic class DemoApplication {\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tSpringApplication.run(DemoApplication.class, args);\\n\\t}\\n}\\n\\n@RestController\\nclass CalculatorController {\\n\\n\\t@GetMapping(\\\"/add\\\")\\n\\tpublic int add(@RequestParam int a, @RequestParam int b) {\\n\\t\\treturn a + b;\\n\\t}\\n\\n\\t@GetMapping(\\\"/sub\\\")\\n\\tpublic int subtract(@RequestParam int a, @RequestParam int b) {\\n\\t\\treturn a - b;\\n\\t}\\n\\n\\t@GetMapping(\\\"/mul\\\")\\n\\tpublic int multiply(@RequestParam int a, @RequestParam int b) {\\n\\t\\treturn a * b;\\n\\t}\\n\\n\\t@GetMapping(\\\"/div\\\")\\n\\tpublic String divide(@RequestParam int a, @RequestParam int b) {\\n\\t\\tif(b == 0) {\\n\\t\\t\\treturn \\\"Cannot divide by zero\\\";\\n\\t\\t}\\n\\t\\treturn String.valueOf(a / b);\\n\\t}\\n}"
15
- },
16
- "springboot_even_odd": {
17
- "title": "Spring Boot Even Odd API",
18
- "code": "package com.example.demo;\\n\\nimport org.springframework.boot.SpringApplication;\\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\\nimport org.springframework.web.bind.annotation.*;\\n\\n@SpringBootApplication\\npublic class DemoApplication {\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tSpringApplication.run(DemoApplication.class, args);\\n\\t}\\n}\\n\\n@RestController\\nclass EvenOddController {\\n\\n\\t@GetMapping(\\\"/check\\\")\\n\\tpublic String checkEvenOdd(@RequestParam int number) {\\n\\t\\tif (number % 2 == 0) {\\n\\t\\t\\treturn number + \\\" is Even\\\";\\n\\t\\t} else {\\n\\t\\t\\treturn number + \\\" is Odd\\\";\\n\\t\\t}\\n\\t}\\n}"
19
- },
20
- "springboot_factorial": {
21
- "title": "Spring Boot Factorial API (Service + Controller)",
22
- "code": "package com.example.demo;\\n\\nimport org.springframework.boot.SpringApplication;\\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\\nimport org.springframework.web.bind.annotation.*;\\nimport org.springframework.beans.factory.annotation.Autowired;\\nimport org.springframework.stereotype.Service;\\n\\n@SpringBootApplication\\npublic class DemoApplication {\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tSpringApplication.run(DemoApplication.class, args);\\n\\t}\\n}\\n\\n@Service\\nclass FactorialService {\\n\\n\\tpublic long calculateFactorial(int n) {\\n\\t\\tif (n < 0) {\\n\\t\\t\\treturn -1;\\n\\t\\t}\\n\\n\\t\\tlong result = 1;\\n\\t\\tfor (int i = 1; i <= n; i++) {\\n\\t\\t\\tresult *= i;\\n\\t\\t}\\n\\n\\t\\treturn result;\\n\\t}\\n}\\n\\n@RestController\\nclass FactorialController {\\n\\n\\t@Autowired\\n\\tprivate FactorialService factorialService;\\n\\n\\t@GetMapping(\\\"/factorial\\\")\\n\\tpublic String getFactorial(@RequestParam int number) {\\n\\n\\t\\tlong result = factorialService.calculateFactorial(number);\\n\\n\\t\\tif (result == -1) {\\n\\t\\t\\treturn \\\"Invalid number\\\";\\n\\t\\t}\\n\\n\\t\\treturn \\\"Factorial of \\\" + number + \\\" is \\\" + result;\\n\\t}\\n}"
23
- },
24
- "custom_exception_java": {
25
- "title": "Java Custom Exception Example",
26
- "code": "class MyException extends Exception {\\n\\n\\tMyException(String message) {\\n\\t\\tsuper(message);\\n\\t}\\n}\\n\\npublic class CustomExceptionDemo {\\n\\n\\tstatic void checkAge(int age) throws MyException {\\n\\t\\tif (age < 18) {\\n\\t\\t\\tthrow new MyException(\\\"Age must be 18 or above\\\");\\n\\t\\t} else {\\n\\t\\t\\tSystem.out.println(\\\"You are eligible\\\");\\n\\t\\t}\\n\\t}\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\ttry {\\n\\t\\t\\tcheckAge(16);\\n\\t\\t} catch (MyException e) {\\n\\t\\t\\tSystem.out.println(\\\"Exception: \\\" + e.getMessage());\\n\\t\\t}\\n\\t}\\n}"
27
- },
28
- "thread_lifecycle_java": {
29
- "title": "Java Thread Life Cycle Example",
30
- "code": "class MyThread extends Thread {\\n\\n\\tpublic void run() {\\n\\t\\tSystem.out.println(\\\"Thread is in RUNNING state\\\");\\n\\n\\t\\ttry {\\n\\t\\t\\tThread.sleep(1000);\\n\\t\\t\\tSystem.out.println(\\\"Thread is in TIMED WAITING state\\\");\\n\\t\\t} catch (InterruptedException e) {\\n\\t\\t\\tSystem.out.println(e);\\n\\t\\t}\\n\\n\\t\\tSystem.out.println(\\\"Thread execution finished (TERMINATED)\\\");\\n\\t}\\n}\\n\\npublic class ThreadLifeCycleDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tMyThread t1 = new MyThread();\\n\\n\\t\\tSystem.out.println(\\\"State after creation: \\\" + t1.getState());\\n\\n\\t\\tt1.start();\\n\\t\\tSystem.out.println(\\\"State after start(): \\\" + t1.getState());\\n\\n\\t\\ttry {\\n\\t\\t\\tThread.sleep(500);\\n\\t\\t\\tSystem.out.println(\\\"State during execution: \\\" + t1.getState());\\n\\t\\t\\tt1.join();\\n\\t\\t} catch (InterruptedException e) {\\n\\t\\t\\tSystem.out.println(e);\\n\\t\\t}\\n\\n\\t\\tSystem.out.println(\\\"State after completion: \\\" + t1.getState());\\n\\t}\\n}"
31
- },
32
- "inner_class_java": {
33
- "title": "Java Outer and Inner Class Example",
34
- "code": "class Outer {\\n\\n\\tclass Inner {\\n\\t\\tint value = 10;\\n\\n\\t\\tvoid display() {\\n\\t\\t\\tSystem.out.println(\\\"Inner class method called\\\");\\n\\t\\t}\\n\\t}\\n\\n\\tvoid accessInner() {\\n\\t\\tInner obj = new Inner();\\n\\n\\t\\tSystem.out.println(\\\"Value from Inner class: \\\" + obj.value);\\n\\t\\tobj.display();\\n\\t}\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tOuter o = new Outer();\\n\\t\\to.accessInner();\\n\\t}\\n}"
35
- },
36
- "interface_drawable_java": {
37
- "title": "Java Interface Drawable Example",
38
- "code": "interface Drawable {\\n\\tvoid draw();\\n}\\n\\nclass Circle implements Drawable {\\n\\n\\tpublic void draw() {\\n\\t\\tSystem.out.println(\\\"Drawing Circle\\\");\\n\\t}\\n}\\n\\nclass Rectangle implements Drawable {\\n\\n\\tpublic void draw() {\\n\\t\\tSystem.out.println(\\\"Drawing Rectangle\\\");\\n\\t}\\n}\\n\\npublic class InterfaceDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tDrawable d1 = new Circle();\\n\\t\\tDrawable d2 = new Rectangle();\\n\\n\\t\\td1.draw();\\n\\t\\td2.draw();\\n\\t}\\n}"
39
- },
40
- "java_package_example": {
41
- "title": "Java Package Creation and Import Example",
42
- "code": "package com.example.geometry;\\n\\npublic class Shape {\\n\\n\\tpublic void draw() {\\n\\t\\tSystem.out.println(\\\"Drawing Shape\\\");\\n\\t}\\n}\\n\\n// In another file\\n\\nimport com.example.geometry.Shape;\\n\\npublic class PackageDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tShape s = new Shape();\\n\\t\\ts.draw();\\n\\t}\\n}"
43
- },
44
- "inheritance_shape_java": {
45
- "title": "Java Inheritance and Method Overriding Example",
46
- "code": "class Shape {\\n\\n\\tvoid calculateArea() {\\n\\t\\tSystem.out.println(\\\"Calculating area of shape\\\");\\n\\t}\\n}\\n\\nclass Circle extends Shape {\\n\\tdouble radius = 5;\\n\\n\\tvoid calculateArea() {\\n\\t\\tdouble area = Math.PI * radius * radius;\\n\\t\\tSystem.out.println(\\\"Area of Circle: \\\" + area);\\n\\t}\\n}\\n\\nclass Rectangle extends Shape {\\n\\tint length = 4;\\n\\tint width = 6;\\n\\n\\tvoid calculateArea() {\\n\\t\\tint area = length * width;\\n\\t\\tSystem.out.println(\\\"Area of Rectangle: \\\" + area);\\n\\t}\\n}\\n\\npublic class InheritanceDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tShape s1 = new Circle();\\n\\t\\tShape s2 = new Rectangle();\\n\\n\\t\\ts1.calculateArea();\\n\\t\\ts2.calculateArea();\\n\\t}\\n}"
47
- },
48
- "method_overloading_java": {
49
- "title": "Java Method Overloading Calculator Example",
50
- "code": "class Calculator {\\n\\n\\tint add(int a, int b) {\\n\\t\\treturn a + b;\\n\\t}\\n\\n\\tdouble add(double a, double b) {\\n\\t\\treturn a + b;\\n\\t}\\n}\\n\\npublic class MethodOverloadingDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tCalculator calc = new Calculator();\\n\\n\\t\\tint intResult = calc.add(10, 20);\\n\\t\\tSystem.out.println(\\\"Integer Addition: \\\" + intResult);\\n\\n\\t\\tdouble doubleResult = calc.add(5.5, 2.3);\\n\\t\\tSystem.out.println(\\\"Double Addition: \\\" + doubleResult);\\n\\t}\\n}"
51
- },
52
2
  "palindrome_user_input_java": {
53
3
  "title": "Java Palindrome Number with User Input",
54
4
  "code": "import java.util.Scanner;\\n\\npublic class Palindrome {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tScanner sc = new Scanner(System.in);\\n\\n\\t\\tSystem.out.print(\\\"Enter a number: \\\" );\\n\\t\\tint num = sc.nextInt();\\n\\n\\t\\tint original = num;\\n\\t\\tint reverse = 0;\\n\\n\\t\\twhile (num > 0) {\\n\\t\\t\\tint digit = num % 10;\\n\\t\\t\\treverse = reverse * 10 + digit;\\n\\t\\t\\tnum = num / 10;\\n\\t\\t}\\n\\n\\t\\tif (original == reverse) {\\n\\t\\t\\tSystem.out.println(\\\"Palindrome Number\\\");\\n\\t\\t} else {\\n\\t\\t\\tSystem.out.println(\\\"Not a Palindrome\\\");\\n\\t\\t}\\n\\n\\t\\tsc.close();\\n\\t}\\n}"
@@ -72,6 +22,41 @@
72
22
  "reverse_number_java": {
73
23
  "title": "Java Reverse Number with User Input",
74
24
  "code": "import java.util.Scanner;\\n\\npublic class ReverseNumber {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tScanner sc = new Scanner(System.in);\\n\\n\\t\\tSystem.out.print(\\\"Enter a number: \\\" );\\n\\t\\tint num = sc.nextInt();\\n\\n\\t\\tint reverse = 0;\\n\\n\\t\\twhile (num > 0) {\\n\\t\\t\\tint digit = num % 10;\\n\\t\\t\\treverse = reverse * 10 + digit;\\n\\t\\t\\tnum = num / 10;\\n\\t\\t}\\n\\n\\t\\tSystem.out.println(\\\"Reversed Number: \\\" + reverse);\\n\\n\\t\\tsc.close();\\n\\t}\\n}"
25
+ },
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+ "junit_armstrong": {
38
+ "title": "JUnit Armstrong Number Test",
39
+ "code": "public class ArmstrongService {\\n\\n\\tpublic boolean isArmstrong(int num) {\\n\\t\\tint temp = num, sum = 0, rem;\\n\\n\\t\\twhile (num > 0) {\\n\\t\\t\\trem = num % 10;\\n\\t\\t\\tsum += rem * rem * rem;\\n\\t\\t\\tnum /= 10;\\n\\t\\t}\\n\\t\\treturn sum == temp;\\n\\t}\\n}\\n\\nimport org.junit.jupiter.api.Test;\\nimport static org.junit.jupiter.api.Assertions.*;\\n\\npublic class ArmstrongTest {\\n\\n\\t@Test\\n\\tvoid testArmstrong() {\\n\\t\\tArmstrongService s = new ArmstrongService();\\n\\t\\tassertTrue(s.isArmstrong(153));\\n\\t\\tassertFalse(s.isArmstrong(123));\\n\\t}\\n}"
40
+ },
41
+ "junit_volume": {
42
+ "title": "JUnit Volume Calculation Test",
43
+ "code": "public class VolumeService {\\n\\n\\tpublic double sphere(double r) {\\n\\t\\treturn (4.0 / 3.0) * Math.PI * r * r * r;\\n\\t}\\n\\n\\tpublic double cylinder(double r, double h) {\\n\\t\\treturn Math.PI * r * r * h;\\n\\t}\\n\\n\\tpublic double cube(double a) {\\n\\t\\treturn a * a * a;\\n\\t}\\n}\\n\\nimport org.junit.jupiter.api.Test;\\nimport static org.junit.jupiter.api.Assertions.*;\\n\\npublic class VolumeTest {\\n\\n\\tVolumeService s = new VolumeService();\\n\\n\\t@Test\\n\\tvoid testSphere() {\\n\\t\\tassertEquals(523.5, s.sphere(5), 0.1);\\n\\t}\\n\\n\\t@Test\\n\\tvoid testCylinder() {\\n\\t\\tassertEquals(314.1, s.cylinder(5, 4), 0.1);\\n\\t}\\n\\n\\t@Test\\n\\tvoid testCube() {\\n\\t\\tassertEquals(27, s.cube(3));\\n\\t}\\n}"
44
+ },
45
+ "junit_area": {
46
+ "title": "JUnit Area Calculation Test",
47
+ "code": "public class AreaService {\\n\\n\\tpublic double circle(double r) {\\n\\t\\treturn Math.PI * r * r;\\n\\t}\\n\\n\\tpublic double rectangle(double l, double b) {\\n\\t\\treturn l * b;\\n\\t}\\n\\n\\tpublic double triangle(double b, double h) {\\n\\t\\treturn 0.5 * b * h;\\n\\t}\\n}\\n\\nimport org.junit.jupiter.api.Test;\\nimport static org.junit.jupiter.api.Assertions.*;\\n\\npublic class AreaTest {\\n\\n\\tAreaService s = new AreaService();\\n\\n\\t@Test\\n\\tvoid testCircle() {\\n\\t\\tassertEquals(78.5, s.circle(5), 0.1);\\n\\t}\\n\\n\\t@Test\\n\\tvoid testRectangle() {\\n\\t\\tassertEquals(20, s.rectangle(5, 4));\\n\\t}\\n\\n\\t@Test\\n\\tvoid testTriangle() {\\n\\t\\tassertEquals(10, s.triangle(5, 4));\\n\\t}\\n}"
48
+ },
49
+ "testng_selenium_setup": {
50
+ "title": "Practical 5 TestNG and Selenium Setup Steps",
51
+ "code": "A) Setup TestNG in Maven Project\\n\\nStep 1: Create Maven Project\\nOpen Eclipse IDE\\nGo to File -> New -> Maven Project\\nSelect Create a simple project\\nClick Next\\n\\nEnter details:\\nGroupId: com.bca\\nArtifactId: PracticeTestNG\\nName: PracticeTestNG\\nClick Finish\\n\\nStep 2: Fix pom.xml Error\\nGo to Window -> Preferences -> Maven\\nEnable Update Maven Projects on Startup\\nClick Apply and Close\\n\\nStep 3: Add TestNG Dependency\\nOpen pom.xml and add:\\n<dependencies>\\n <dependency>\\n <groupId>org.testng</groupId>\\n <artifactId>testng</artifactId>\\n <version>7.12.0</version>\\n <scope>test</scope>\\n </dependency>\\n</dependencies>\\n\\nRight click project -> Maven -> Update Project\\n\\nStep 4: Install TestNG Plugin\\nGo to Help -> Eclipse Marketplace\\nSearch TestNG\\nInstall and restart Eclipse\\n\\nStep 5: Create Test Class\\nGo to src/test/java\\nRight click -> New -> Class\\nName: FirstTest\\n\\nStep 6: Simple Test Code\\nimport org.testng.annotations.Test;\\n\\npublic class FirstTest {\\n @Test\\n public void test1() {\\n System.out.println(\\\"TestNG is working\\\");\\n }\\n}\\n\\nRun using Run As -> TestNG Test\\n\\nB) Selenium + TestNG Setup\\n\\nStep 1: Add Dependencies\\nAdd in pom.xml:\\n<dependency>\\n <groupId>org.seleniumhq.selenium</groupId>\\n <artifactId>selenium-java</artifactId>\\n <version>4.21.0</version>\\n</dependency>\\n\\n<dependency>\\n <groupId>io.github.bonigarcia</groupId>\\n <artifactId>webdrivermanager</artifactId>\\n <version>5.8.0</version>\\n</dependency>\\n\\nRight click -> Maven -> Update Project\\n\\nStep 2: Final Working Code\\npackage mypack;\\n\\nimport org.openqa.selenium.By;\\nimport org.openqa.selenium.Keys;\\nimport org.openqa.selenium.WebDriver;\\nimport org.openqa.selenium.chrome.ChromeDriver;\\nimport org.testng.annotations.Test;\\nimport io.github.bonigarcia.wdm.WebDriverManager;\\n\\npublic class FirstTest {\\n\\n @Test\\n public void TestGoogle() throws Exception {\\n\\n WebDriverManager.chromedriver().setup();\\n\\n WebDriver driver = new ChromeDriver();\\n\\n driver.manage().window().maximize();\\n\\n driver.get(\\\"https://www.google.com/\\\");\\n\\n driver.findElement(By.name(\\\"q\\\"))\\n .sendKeys(\\\"skates\\\", Keys.ENTER);\\n\\n System.out.println(driver.getTitle());\\n\\n Thread.sleep(5000);\\n\\n driver.quit();\\n }\\n}\\n\\nImportant Notes\\n\\nIf Chrome does not open:\\nUpdate Chrome browser and WebDriverManager\\n\\nIf TestNG does not run:\\nUse Run As -> TestNG Test\\n\\nIf import errors occur:\\nEnsure import org.testng.annotations.Test is added"
52
+ },
53
+ "autoit_selenium_steps": {
54
+ "title": "AutoIt + Selenium File Upload Practical Steps",
55
+ "code": "Step 1: Download AutoIt from https://www.autoitscript.com/site/autoit/downloads/\\n\\nStep 2: Download SciTE Editor from https://www.autoitscript.com/site/autoit-script-editor/downloads/\\n\\nStep 3: Install AutoIt by extracting zip and running setup file\\n\\nStep 4: Install SciTE editor and complete setup\\n\\nStep 5: Open SciTE.exe and Au3Info_x64.exe (Finder Tool)\\n\\nStep 6: Open website https://the-internet.herokuapp.com/upload\\n\\nStep 7: Use Finder Tool to get details of file input and open button (Edit1, Button1)\\n\\nStep 8: Write AutoIt script:\\nControlFocus(\\\"Open\\\",\\\"\\\",\\\"Edit1\\\")\\nControlSetText(\\\"Open\\\",\\\"\\\",\\\"Edit1\\\",$CmdLine[1])\\nControlClick(\\\"Open\\\",\\\"\\\",\\\"Button1\\\")\\n\\nStep 9: Save as hello.au3 and compile using Tools -> Compile (X86 + X64)\\n\\nStep 10: Create Java Selenium project in Eclipse\\n\\nStep 11: Write Selenium code to open browser and click upload button\\n\\nStep 12: Use ProcessBuilder to run hello.exe with file path\\n\\nStep 13: Run Java application\\n\\nOutput: File upload is automated using AutoIt and Selenium"
56
+ },
57
+ "autoit_file_upload": {
58
+ "title": "AutoIt + Selenium File Upload Automation",
59
+ "code": "/* AutoIt Script */\\nControlFocus(\\\"Open\\\",\\\"\\\",\\\"Edit1\\\")\\nControlSetText(\\\"Open\\\",\\\"\\\",\\\"Edit1\\\",$CmdLine[1])\\nControlClick(\\\"Open\\\",\\\"\\\",\\\"Button1\\\")\\n\\n/* Java Selenium Code */\\npackage Auto;\\n\\nimport java.io.IOException;\\nimport org.openqa.selenium.By;\\nimport org.openqa.selenium.WebElement;\\nimport org.openqa.selenium.chrome.ChromeDriver;\\nimport org.openqa.selenium.interactions.Actions;\\n\\npublic class AutoITScirpt {\\n\\n\\tpublic static void main(String[] args) throws IOException, InterruptedException {\\n\\n\\t\\tChromeDriver driver = new ChromeDriver();\\n\\n\\t\\tdriver.get(\\\"https://the-internet.herokuapp.com/upload\\\");\\n\\n\\t\\tSystem.out.println(\\\"URL: \\\" + driver.getCurrentUrl());\\n\\t\\tSystem.out.println(\\\"Title: \\\" + driver.getTitle());\\n\\t\\tSystem.out.println(\\\"Source Length: \\\" + driver.getPageSource().length());\\n\\n\\t\\tWebElement buttonElement = driver.findElement(By.id(\\\"file-upload\\\"));\\n\\n\\t\\tActions act = new Actions(driver);\\n\\t\\tact.moveToElement(buttonElement).click().perform();\\n\\n\\t\\tThread.sleep(2000);\\n\\n\\t\\tProcessBuilder pBuilder = new ProcessBuilder(\\n\\t\\t\\t\\\"C:\\\\\\\\Users\\\\\\\\User\\\\\\\\OneDrive\\\\\\\\Desktop\\\\\\\\material\\\\\\\\STT\\\\\\\\hello.exe\\\",\\n\\t\\t\\t\\\"C:\\\\\\\\Users\\\\\\\\User\\\\\\\\Downloads\\\\\\\\chromedriver-win64\\\\\\\\hello.txt\\\"\\n\\t\\t);\\n\\n\\t\\tProcess process = pBuilder.start();\\n\\t\\tprocess.waitFor();\\n\\t}\\n}"
75
60
  }
76
61
  }
77
62
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chiwormjava",
3
- "version": "1.0.1",
3
+ "version": "2.0.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"