Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven

on: [push, pull_request]
Expand All @@ -15,17 +7,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8.0
uses: actions/setup-java@v3
with:
java-version: '8.0'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
cache: maven

- name: Run the Maven verify phase
run: mvn --batch-mode --update-snapshots verify
- name: Verify Java version
run: |
echo "JAVA_HOME=$JAVA_HOME"
java -version
mvn -version


- name: Build with Maven
run: mvn -B clean package --file pom.xml
91 changes: 91 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*
replay_pid*

##############################
## Maven
##############################
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
pom.xml.bak
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

##############################
## Gradle
##############################
bin/
build/
.gradle
.gradletasknamecache
gradle-app.setting
!gradle-wrapper.jar

##############################
## IntelliJ
##############################
out/
.idea/
.idea_modules/
*.iml
*.ipr
*.iws

##############################
## Eclipse
##############################
.settings/
tmp/
.metadata
.classpath
.project
*.tmp
*.bak
*.swp
*~.nib
local.properties
.loadpath
.factorypath

##############################
## NetBeans
##############################
nbproject/private/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

##############################
## Visual Studio Code
##############################
.vscode/
.code-workspace

##############################
## OS X
##############################
.DS_Store

##############################
## Miscellaneous
##############################
*.log

chrome-win64/
chromedriver-win64/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class App

Обратиться через браузер на адрес **https://api.ipify.org/?format=json** и получить json-ответ, содержащий IP4-адрес клиента. Извлечь адрес и вывести на экран в виде строки.

# Задание №3
## Задание №3

Через сайт **https://open-meteo.com** получить прогноз погоды на сутки. Использовать в качестве местоположения координаты Нижнего Новгорода (56, 44).

Expand Down
46 changes: 46 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>ST-7</artifactId>
<version>1.0-SNAPSHOT</version>
<name>ST-7</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<selenium.version>4.15.0</selenium.version>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.15.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<mainClass>com.mycompany.app.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
26 changes: 26 additions & 0 deletions result/forecast.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
№ Date t rain
-----------------------------------
1 2026-06-07T00:00 9,4°C 0,00
2 2026-06-07T01:00 8,7°C 0,00
3 2026-06-07T02:00 8,1°C 0,00
4 2026-06-07T03:00 6,6°C 0,00
5 2026-06-07T04:00 6,8°C 0,00
6 2026-06-07T05:00 8,7°C 0,00
7 2026-06-07T06:00 12,5°C 0,00
8 2026-06-07T07:00 16,2°C 0,00
9 2026-06-07T08:00 18,3°C 0,00
10 2026-06-07T09:00 20,5°C 0,00
11 2026-06-07T10:00 21,8°C 0,00
12 2026-06-07T11:00 22,5°C 0,00
13 2026-06-07T12:00 22,9°C 0,00
14 2026-06-07T13:00 22,9°C 0,00
15 2026-06-07T14:00 23,9°C 0,00
16 2026-06-07T15:00 24,4°C 0,00
17 2026-06-07T16:00 24,3°C 0,00
18 2026-06-07T17:00 24,0°C 0,00
19 2026-06-07T18:00 23,1°C 0,00
20 2026-06-07T19:00 21,7°C 0,00
21 2026-06-07T20:00 19,4°C 0,00
22 2026-06-07T21:00 17,4°C 0,00
23 2026-06-07T22:00 16,1°C 0,00
24 2026-06-07T23:00 15,5°C 0,00
28 changes: 28 additions & 0 deletions src/main/java/com/mycompany/app/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mycompany.app;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class App {

public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:/tmp/chrome-win64/chromedriver-win64/chromedriver-win64/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("C:/tmp/chrome-win64/chrome-win64/chrome.exe");
WebDriver webDriver = new ChromeDriver(options);
try {
webDriver.get("https://www.calculator.net/password-generator.html");
WebElement passwordText = webDriver.findElement(By.cssSelector("div.verybigtext b"));
System.out.println("Task 1: " + passwordText.getText());
System.out.println("Task 2: " + Task2.getMyIP(webDriver));
System.out.println("Task 3: \n" + Task3.getWeatherForecast(webDriver));
} catch (Exception e) {
System.out.println("Error: " + e);
} finally {
webDriver.quit();
}
}
}
21 changes: 21 additions & 0 deletions src/main/java/com/mycompany/app/DriverSettings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.mycompany.app;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;

final class DriverSettings {

static final String CHROME_DRIVER_PATH =
"C:/tmp/chrome-win64/chromedriver-win64/chromedriver-win64/chromedriver.exe";
static final String CHROME_BINARY_PATH = "C:/tmp/chrome-win64/chrome-win64/chrome.exe";

static final Duration PAGE_LOAD_TIMEOUT = Duration.ofSeconds(90);
static final Duration IMPLICIT_WAIT = Duration.ofSeconds(10);
static final Duration EXPLICIT_WAIT = Duration.ofSeconds(15);

static final Path FORECAST_OUTPUT = Paths.get("result", "forecast.txt");

private DriverSettings() {
}
}
Loading
Loading