Skip to content

Commit 8d7cad5

Browse files
author
Suresh Kumar Reddy
committed
v 1.0
FIrst Release
1 parent 9be28f8 commit 8d7cad5

24 files changed

+391
-98
lines changed

.classpath

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<classpath>
33
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
44
<classpathentry kind="src" path="src"/>
5-
<classpathentry kind="lib" path="lib/basicplayer3.0.jar"/>
65
<classpathentry kind="lib" path="lib/byte-buddy-1.7.9.jar"/>
76
<classpathentry kind="lib" path="lib/client-combined-3.9.1-sources.jar"/>
87
<classpathentry kind="lib" path="lib/client-combined-3.9.1.jar"/>
@@ -13,20 +12,11 @@
1312
<classpathentry kind="lib" path="lib/commons-io-2.6-test-sources.jar"/>
1413
<classpathentry kind="lib" path="lib/commons-io-2.6-tests.jar"/>
1514
<classpathentry kind="lib" path="lib/commons-io-2.6.jar"/>
16-
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
17-
<classpathentry kind="lib" path="lib/commons-logging-api.jar"/>
1815
<classpathentry kind="lib" path="lib/gson-2.8.2.jar"/>
1916
<classpathentry kind="lib" path="lib/guava-23.6-jre.jar"/>
2017
<classpathentry kind="lib" path="lib/httpclient-4.5.3.jar"/>
2118
<classpathentry kind="lib" path="lib/httpcore-4.4.6.jar"/>
22-
<classpathentry kind="lib" path="lib/jl1.0.jar"/>
23-
<classpathentry kind="lib" path="lib/jogg-0.0.7.jar"/>
24-
<classpathentry kind="lib" path="lib/jorbis-0.0.15.jar"/>
25-
<classpathentry kind="lib" path="lib/jspeex0.9.7.jar"/>
26-
<classpathentry kind="lib" path="lib/mp3spi1.9.4.jar"/>
2719
<classpathentry kind="lib" path="lib/okhttp-3.9.1.jar"/>
2820
<classpathentry kind="lib" path="lib/okio-1.13.0.jar"/>
29-
<classpathentry kind="lib" path="lib/tritonus_share.jar"/>
30-
<classpathentry kind="lib" path="lib/vorbisspi1.0.2.jar"/>
3121
<classpathentry kind="output" path="bin"/>
3222
</classpath>

alarm.mp3

-265 KB
Binary file not shown.

bin/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/main/

bin/Alert.class

-4.13 KB
Binary file not shown.

lib/basicplayer3.0.jar

-10.8 KB
Binary file not shown.

lib/commons-logging-1.2.jar

-60.4 KB
Binary file not shown.

lib/commons-logging-api.jar

-25.6 KB
Binary file not shown.

lib/jl1.0.jar

-103 KB
Binary file not shown.

lib/jogg-0.0.7.jar

-6.68 KB
Binary file not shown.

lib/jorbis-0.0.15.jar

-57.5 KB
Binary file not shown.

lib/jspeex0.9.7.jar

-97.5 KB
Binary file not shown.

lib/mp3spi1.9.4.jar

-24 KB
Binary file not shown.

lib/tritonus_share.jar

-100 KB
Binary file not shown.

lib/vorbisspi1.0.2.jar

-13.5 KB
Binary file not shown.

src/Alert.java

Lines changed: 0 additions & 88 deletions
This file was deleted.

src/main/java/Alert.java

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
package main.java;
2+
3+
import java.io.File;
4+
import java.io.FileOutputStream;
5+
import java.io.IOException;
6+
import java.io.InputStream;
7+
import java.io.OutputStream;
8+
9+
import javax.sound.sampled.AudioInputStream;
10+
import javax.sound.sampled.AudioSystem;
11+
import javax.sound.sampled.Clip;
12+
13+
import org.apache.commons.io.FileUtils;
14+
import org.openqa.selenium.By;
15+
import org.openqa.selenium.NoAlertPresentException;
16+
import org.openqa.selenium.OutputType;
17+
import org.openqa.selenium.TakesScreenshot;
18+
import org.openqa.selenium.WebDriver;
19+
import org.openqa.selenium.WebElement;
20+
import org.openqa.selenium.chrome.ChromeDriver;
21+
import org.openqa.selenium.chrome.ChromeOptions;
22+
23+
24+
public class Alert {
25+
26+
public Alert(String usn, Boolean cbcs) {
27+
28+
File temp = null;
29+
30+
try {
31+
String filename = "/main/resources/chromedriver.exe";
32+
System.out.println(Alpha.class.getResource(filename));
33+
InputStream fi = Alpha.class.getResourceAsStream(filename);
34+
temp = File.createTempFile("temp_exe", "");
35+
OutputStream fo = new FileOutputStream(temp);
36+
byte[] b = new byte[1024];
37+
int count = 0;
38+
while ((count = fi.read(b)) != -1) {
39+
fo.write(b, 0, count);
40+
}
41+
fi.close();
42+
fo.close();
43+
44+
//System.out.println(temp.canExecute());
45+
Runtime.getRuntime().exec(temp.getPath());
46+
47+
} catch (Exception e) {
48+
e.printStackTrace();
49+
}
50+
51+
//System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
52+
System.setProperty("webdriver.chrome.driver", temp.getPath());
53+
54+
while(true)
55+
{
56+
ChromeOptions chromeOptions = new ChromeOptions();
57+
chromeOptions.addArguments("--headless");
58+
WebDriver driver = new ChromeDriver(chromeOptions);
59+
if(cbcs == true)
60+
driver.get("http://results.vtu.ac.in/vitaviresultcbcs/index.php");
61+
else
62+
driver.get("http://results.vtu.ac.in/vitaviresultnoncbcs/index.php");
63+
64+
65+
WebElement element = driver.findElement(By.xpath(".//*[@id='raj']/div[1]/div/input"));
66+
67+
element.sendKeys(usn);
68+
69+
element = driver.findElement(By.id("submit"));
70+
element.click();
71+
72+
try
73+
{
74+
driver.switchTo().alert().dismiss();
75+
}
76+
catch (NoAlertPresentException Ex)
77+
{
78+
driver.manage().window().fullscreen();
79+
File src= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
80+
try {
81+
String demo = System.getProperty("user.home");
82+
FileUtils.copyFile(src, new File(demo+"\\Desktop\\MyVtuResult.png"));
83+
}
84+
85+
catch (IOException e)
86+
{
87+
System.out.println(e.getMessage());
88+
89+
}
90+
91+
92+
try{
93+
AudioInputStream audioInputStream =
94+
AudioSystem.getAudioInputStream(
95+
this.getClass().getResource("/main/resources/alarm.wav"));
96+
Clip clip = AudioSystem.getClip();
97+
clip.open(audioInputStream);
98+
clip.start();
99+
}
100+
catch(Exception ex)
101+
{
102+
System.out.println(ex);
103+
}
104+
105+
106+
}
107+
driver.quit();
108+
try {
109+
//Check for results every 30 seconds
110+
//30000 = 30s
111+
//60000 = 1m
112+
//Do not set this number too low which might result in your IP being blocked by the page
113+
Thread.sleep(30000);
114+
} catch(Exception e)
115+
{
116+
System.out.println("Thread error:" + e);
117+
}
118+
119+
}
120+
}
121+
122+
123+
}

0 commit comments

Comments
 (0)