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
23f418ea
Commit
23f418ea
authored
Oct 19, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录算法调整
parent
e9a8ac49
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
13 deletions
+29
-13
ClassInAccountManager.cs
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
+29
-13
No files found.
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
View file @
23f418ea
...
...
@@ -264,29 +264,45 @@ namespace TicketSpider.Spiders.ClassInRule
{
Directory
.
CreateDirectory
(
dirpath
);
}
driver
.
SwitchTo
().
Frame
(
driver
.
FindElement
(
By
.
Id
(
"tcaptcha_iframe"
)));
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementById(\"slideBlock\").style.display = 'none';"
);
//获取验证码弹窗
driver
.
SwitchTo
().
Frame
(
driver
.
FindElement
(
By
.
Id
(
"tcaptcha_iframe_dy"
)));
//获取背景图
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementsByClassName(\"tc-fg-item\")[0].style.display = 'none';document.getElementsByClassName(\"tc-fg-item\")[1].style.display = 'none';document.getElementsByClassName(\"tc-fg-item\")[2].style.display = 'none';"
);
var
bgPng
=
((
ITakesScreenshot
)
driver
.
FindElement
(
By
.
Id
(
"slideBg"
))).
GetScreenshot
();
var
fileBgPath
=
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
.png"
;
bgPng
.
SaveAsFile
(
fileBgPath
,
ScreenshotImageFormat
.
Png
);
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElement
ById(\"slideBlock\").style.display = 'block';document.getElementById(\"slideBg\").style.opacity = 0
;"
);
var
blockPng
=
((
ITakesScreenshot
)
driver
.
FindElement
(
By
.
Id
(
"slideBlock"
))).
GetScreenshot
(
);
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementById(\"slideBg\").style.opacity = 1;"
);
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElement
sByClassName(\"tc-fg-item\")[0].style.display = 'block';document.getElementsByClassName(\"tc-fg-item\")[1].style.display = 'block';document.getElementsByClassName(\"tc-fg-item\")[2].style.display = 'block'
;"
);
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementById(\"slideBg\").style.display = 'none';"
);
var
blockElements
=
driver
.
FindElements
(
By
.
ClassName
(
"tc-fg-item"
)
);
var
fileBlockPath
=
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
__1.png"
;
blockPng
.
SaveAsFile
(
fileBlockPath
,
ScreenshotImageFormat
.
Png
);
if
(
blockElements
!=
null
&&
blockElements
.
Count
==
3
)
{
int
index
=
0
;
foreach
(
var
item
in
blockElements
)
{
if
(
index
==
blockElements
.
Count
-
2
)
{
var
fileBlockPath2
=
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
__
{
index
}
.png"
;
var
blockPng
=
((
ITakesScreenshot
)
item
).
GetScreenshot
();
blockPng
.
SaveAsFile
(
fileBlockPath
,
ScreenshotImageFormat
.
Png
);
}
index
++;
}
}
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementById(\"slideBg\").style.display = 'block';"
);
var
bgX
=
FireFoxGetBoundary
(
fileBgPath
,
fileBlockPath
);
InfoHelper
.
WriteLine
(
$"读取背景缺口边界X坐标:
{
bgX
}
"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"BeginSliderLoginHandler"
,
$"读取背景缺口边界X坐标:
{
bgX
}
"
);
Actions
action
=
new
(
driver
);
var
sliderButton
=
driver
.
FindElement
(
By
.
Id
(
"tcaptcha_drag_button
"
));
var
sliderButton
=
driver
.
FindElement
(
By
.
ClassName
(
"tc-slider-normal
"
));
if
(
sliderButton
!=
null
)
{
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementById(\"slideBlock\").style.opacity = 1;"
);
//
((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById(\"slideBlock\").style.opacity = 1;");
action
.
ClickAndHold
(
sliderButton
).
Build
().
Perform
();
#
region
开始拟人移动
var
d1
=
Math
.
Round
(
bgX
*
0.8
);
...
...
@@ -336,9 +352,9 @@ namespace TicketSpider.Spiders.ClassInRule
Cv2
.
Rectangle
(
bgImg
,
maxLoc
,
bt
,
Scalar
.
Red
,
2
);
string
newImage
=
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
_NewBg.png"
;
Cv2
.
ImWrite
(
newImage
,
bgImg
);
File
.
Delete
(
fileBgPath
);
File
.
Delete
(
fileBlockPath
);
File
.
Delete
(
newImage
);
//
File.Delete(fileBgPath);
//
File.Delete(fileBlockPath);
//
File.Delete(newImage);
return
maxLoc
.
X
-
20
;
}
...
...
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