Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EduSpider
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
EduSpider
Commits
def8be30
Commit
def8be30
authored
Jun 17, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
111
parent
fd4f06d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
ClassInAccountManager.cs
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
+10
-18
No files found.
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
View file @
def8be30
...
@@ -68,7 +68,7 @@ namespace TicketSpider.Spiders.ClassInRule
...
@@ -68,7 +68,7 @@ namespace TicketSpider.Spiders.ClassInRule
IWebElement
pwdEle
;
IWebElement
pwdEle
;
var
option
=
new
ChromeOptions
();
var
option
=
new
ChromeOptions
();
option
.
AddArgument
(
"--incognito"
);
option
.
AddArgument
(
"--incognito"
);
//
option.AddArgument("headless");
option
.
AddArgument
(
"headless"
);
option
.
AddArgument
(
"disable-infobars"
);
option
.
AddArgument
(
"disable-infobars"
);
option
.
AddArgument
(
"window-size=1920,1080"
);
option
.
AddArgument
(
"window-size=1920,1080"
);
option
.
AddArgument
(
"user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
);
option
.
AddArgument
(
"user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
);
...
@@ -101,11 +101,11 @@ namespace TicketSpider.Spiders.ClassInRule
...
@@ -101,11 +101,11 @@ namespace TicketSpider.Spiders.ClassInRule
var
login
=
BeginSliderLoginHandler
(
ref
driver
);
var
login
=
BeginSliderLoginHandler
(
ref
driver
);
if
(
login
.
IsCompleted
)
if
(
login
.
IsCompleted
)
{
{
Thread
.
Sleep
(
1000
*
5
);
driver
.
SwitchTo
().
DefaultContent
();
//driver.SwitchTo().DefaultContent();
Console
.
WriteLine
(
$"操作完成,正在等待结果"
);
Console
.
WriteLine
(
$"操作完成,正在等待结果"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"操作完成,正在等待结果"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"操作完成,正在等待结果"
);
//睡眠1秒,等待跳转
//睡眠1秒,等待跳转
Thread
.
Sleep
(
5
*
1000
);
if
(
driver
.
Url
.
Contains
(
"www.eeo.cn/cn/login"
))
if
(
driver
.
Url
.
Contains
(
"www.eeo.cn/cn/login"
))
{
{
Console
.
WriteLine
(
$"模拟登录失败,准备重新执行..."
);
Console
.
WriteLine
(
$"模拟登录失败,准备重新执行..."
);
...
@@ -129,9 +129,9 @@ namespace TicketSpider.Spiders.ClassInRule
...
@@ -129,9 +129,9 @@ namespace TicketSpider.Spiders.ClassInRule
}
}
else
else
{
{
var
cookies
=
driver
.
Manage
().
Cookies
.
AllCookies
;
Thread
.
Sleep
(
3
*
1000
)
;
//处理
//处理
foreach
(
var
item
in
c
ookies
)
foreach
(
var
item
in
driver
.
Manage
().
Cookies
.
AllC
ookies
)
{
{
_loginCookies
+=
item
.
Name
+
"="
+
item
.
Value
+
";"
;
_loginCookies
+=
item
.
Name
+
"="
+
item
.
Value
+
";"
;
}
}
...
@@ -153,11 +153,8 @@ namespace TicketSpider.Spiders.ClassInRule
...
@@ -153,11 +153,8 @@ namespace TicketSpider.Spiders.ClassInRule
{
{
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"获取cooki失败,
{
ex
.
Message
}
"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"获取cooki失败,
{
ex
.
Message
}
"
);
Console
.
WriteLine
(
$"获取cooki失败,
{
ex
.
Message
}
"
);
Console
.
WriteLine
(
$"获取cooki失败,
{
ex
.
Message
}
"
);
Thread
.
Sleep
(
1000
*
4
);
}
}
driver
.
Close
();
driver
.
Quit
();
driver
.
Quit
();
driver
.
Dispose
();
Console
.
WriteLine
(
"完成登录..."
);
Console
.
WriteLine
(
"完成登录..."
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"完成登录..."
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"RunAsync"
,
$"完成登录..."
);
return
flag
;
return
flag
;
...
@@ -199,25 +196,20 @@ namespace TicketSpider.Spiders.ClassInRule
...
@@ -199,25 +196,20 @@ namespace TicketSpider.Spiders.ClassInRule
var
d1
=
Math
.
Round
(
bgX
*
0.8
);
var
d1
=
Math
.
Round
(
bgX
*
0.8
);
var
d2
=
Math
.
Round
(
bgX
*
0.1
);
var
d2
=
Math
.
Round
(
bgX
*
0.1
);
var
d3
=
Math
.
Round
(
bgX
*
0.1
);
var
d3
=
Math
.
Round
(
bgX
*
0.1
);
Console
.
WriteLine
(
"d1:"
+
d1
);
action
.
MoveByOffset
((
int
)
d1
,
1
);
action
.
MoveByOffset
((
int
)
d1
,
1
);
Thread
.
Sleep
(
new
Random
().
Next
(
100
)
+
150
);
Thread
.
Sleep
(
new
Random
().
Next
(
100
)
+
150
);
Console
.
WriteLine
(
"d2:"
+
d2
);
action
.
MoveByOffset
((
int
)
d2
,
1
);
action
.
MoveByOffset
((
int
)
d2
,
1
);
Thread
.
Sleep
(
new
Random
().
Next
(
100
)
+
150
);
Thread
.
Sleep
(
new
Random
().
Next
(
100
)
+
150
);
Console
.
WriteLine
(
"d3:"
+
d3
);
action
.
MoveByOffset
((
int
)
d3
,
1
);
action
.
MoveByOffset
((
int
)
d3
,
1
);
action
.
MoveByOffset
((
bgX
-
(
int
)
d1
-
(
int
)
d2
-
(
int
)
d3
),
1
);
int
last
=
(
bgX
-
(
int
)
d1
-
(
int
)
d2
-
(
int
)
d3
);
Console
.
WriteLine
(
"last:"
+
last
);
action
.
MoveByOffset
(
last
,
1
);
Thread
.
Sleep
(
2000
);
Thread
.
Sleep
(
2000
);
#
endregion
#
endregion
action
.
Release
(
sliderButton
);
action
.
Release
(
sliderButton
);
action
.
Build
().
Perform
();
action
.
Build
().
Perform
();
driver
.
SwitchTo
().
DefaultContent
();
driver
.
SwitchTo
().
DefaultContent
();
}
}
File
.
Delete
(
fileBgPath
);
File
.
Delete
(
fileBgPath
);
...
@@ -251,7 +243,7 @@ namespace TicketSpider.Spiders.ClassInRule
...
@@ -251,7 +243,7 @@ namespace TicketSpider.Spiders.ClassInRule
var
dirpath
=
$"
{
Environment
.
CurrentDirectory
}
\\geetest"
;
var
dirpath
=
$"
{
Environment
.
CurrentDirectory
}
\\geetest"
;
Cv2
.
ImWrite
(
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
.png"
,
bgImg
);
Cv2
.
ImWrite
(
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
.png"
,
bgImg
);
return
maxLoc
.
X
-
2
5
;
return
maxLoc
.
X
-
2
0
;
}
}
private
static
void
HeartLine
()
private
static
void
HeartLine
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment