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
893902aa
Commit
893902aa
authored
Nov 22, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
23f418ea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
15 deletions
+35
-15
ClassInAccountManager.cs
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
+32
-12
ClassInFlow.cs
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
+2
-2
appsettings.json
EduSpider/appsettings.json
+1
-1
No files found.
EduSpider/Spiders/ClassInRule/ClassInAccountManager.cs
View file @
893902aa
...
...
@@ -69,7 +69,7 @@ namespace TicketSpider.Spiders.ClassInRule
public
static
bool
RunAsync
()
{
var
flag
=
false
;
var
option
=
new
FirefoxOptions
();
option
.
AddArgument
(
"--incognito"
);
string
IsOpenChrome
=
VTX
.
FW
.
Helper
.
ConfigHelper
.
GetAppsettings
(
"IsOpenChrome"
);
...
...
@@ -123,8 +123,10 @@ namespace TicketSpider.Spiders.ClassInRule
});
if
(
inputEle
!=
null
&&
pwdEle
!=
null
)
{
inputEle
.
SendKeys
(
"18140082327"
);
pwdEle
.
SendKeys
(
"ls123456"
);
inputEle
.
SendKeys
(
"18140082527"
);
//a123456 校管家新密码
//ls123456 校管家老密码
pwdEle
.
SendKeys
(
"a123456"
);
}
}
catch
(
Exception
ex
)
...
...
@@ -272,29 +274,48 @@ namespace TicketSpider.Spiders.ClassInRule
var
fileBgPath
=
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
.png"
;
bgPng
.
SaveAsFile
(
fileBgPath
,
ScreenshotImageFormat
.
Png
);
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementsByClassName(\"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"
;
var
blockElements
=
driver
.
FindElements
(
By
.
ClassName
(
"tc-fg-item"
));
var
fileBlockPath1
=
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
__1.png"
;
var
fileBlockPath2
=
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
__2.png"
;
var
fileBlockPath3
=
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
__3.png"
;
if
(
blockElements
!=
null
&&
blockElements
.
Count
==
3
)
{
int
index
=
0
;
foreach
(
var
item
in
blockElements
)
{
if
(
index
==
blockElements
.
Count
-
2
)
if
(
index
==
0
)
{
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementsByClassName(\"tc-fg-item\")[0].style.display = 'block';"
);
//var blockPng = ((ITakesScreenshot)item).GetScreenshot();
//blockPng.SaveAsFile(fileBlockPath1, ScreenshotImageFormat.Png);
}
if
(
index
==
1
)
{
var
fileBlockPath2
=
$"
{
dirpath
}
\\
{
DateTime
.
Now
.
Ticks
}
__
{
index
}
.png"
;
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementsByClassName(\"tc-fg-item\")[1].style.display = 'block';"
)
;
var
blockPng
=
((
ITakesScreenshot
)
item
).
GetScreenshot
();
blockPng
.
SaveAsFile
(
fileBlockPath
,
ScreenshotImageFormat
.
Png
);
blockPng
.
SaveAsFile
(
fileBlockPath2
,
ScreenshotImageFormat
.
Png
);
}
if
(
index
==
2
)
{
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementsByClassName(\"tc-fg-item\")[2].style.display = 'block';"
);
var
blockPng
=
((
ITakesScreenshot
)
item
).
GetScreenshot
();
blockPng
.
SaveAsFile
(
fileBlockPath3
,
ScreenshotImageFormat
.
Png
);
}
index
++;
}
}
((
IJavaScriptExecutor
)
driver
).
ExecuteScript
(
"document.getElementById(\"slideBg\").style.display = 'block';"
);
var
bgX
=
FireFoxGetBoundary
(
fileBgPath
,
fileBlockPath
);
var
bgX
=
FireFoxGetBoundary
(
fileBgPath
,
fileBlockPath2
);
if
(
bgX
<
0
)
{
bgX
=
FireFoxGetBoundary
(
fileBgPath
,
fileBlockPath3
);
}
InfoHelper
.
WriteLine
(
$"读取背景缺口边界X坐标:
{
bgX
}
"
);
VTX
.
FW
.
Helper
.
LogHelper
.
WriteInfo
(
"BeginSliderLoginHandler"
,
$"读取背景缺口边界X坐标:
{
bgX
}
"
);
...
...
@@ -302,7 +323,6 @@ namespace TicketSpider.Spiders.ClassInRule
var
sliderButton
=
driver
.
FindElement
(
By
.
ClassName
(
"tc-slider-normal"
));
if
(
sliderButton
!=
null
)
{
//((IJavaScriptExecutor)driver).ExecuteScript("document.getElementById(\"slideBlock\").style.opacity = 1;");
action
.
ClickAndHold
(
sliderButton
).
Build
().
Perform
();
#
region
开始拟人移动
var
d1
=
Math
.
Round
(
bgX
*
0.8
);
...
...
EduSpider/Spiders/ClassInRule/ClassInFlow.cs
View file @
893902aa
...
...
@@ -19,7 +19,7 @@ namespace TicketSpider.Spiders.ClassInRule
{
ClassInAccountManager
.
ClearCookie
();
string
key
=
EduSpider
.
Cache
.
CacheKey
.
ClassIn_Cookie_Key
;
int
ExpirTime
=
60
*
60
*
12
;
int
ExpirTime
=
60
*
60
*
12
;
var
cacheCookie
=
EduSpider
.
Cache
.
User
.
UserReidsCache
.
GetClassInCookie
(
key
);
if
(
cacheCookie
!=
null
&&
!
string
.
IsNullOrEmpty
(
cacheCookie
.
CacheCookies
.
ToString
()))
{
...
...
@@ -30,7 +30,7 @@ namespace TicketSpider.Spiders.ClassInRule
loginCookies
=
ClassInAccountManager
.
GetInstance
();
if
(!
string
.
IsNullOrEmpty
(
loginCookies
))
{
EduSpider
.
Cache
.
User
.
UserReidsCache
.
ClassInCookieSet
(
key
,
new
EduSpider
.
Cache
.
User
.
ClassInTokenItem
()
{
CacheCookies
=
loginCookies
},
ExpirTime
);
EduSpider
.
Cache
.
User
.
UserReidsCache
.
ClassInCookieSet
(
key
,
new
EduSpider
.
Cache
.
User
.
ClassInTokenItem
()
{
CacheCookies
=
loginCookies
},
ExpirTime
);
}
}
}
...
...
EduSpider/appsettings.json
View file @
893902aa
{
//连接字符串
"ConnectionStrings"
:
{
"DefaultConnection"
:
"server=
rm-bp1tj77h6kp0d02fbwo.mysql.rds.aliyuncs.com;user id=reborn;password=Reborn@2018;database=uat_
reborn_think;CharSet=utf8mb4; Convert Zero Datetime=true; "
,
"DefaultConnection"
:
"server=
192.168.10.214;user id=reborn;password=Reborn@2018;database=
reborn_think;CharSet=utf8mb4; Convert Zero Datetime=true; "
,
"DefaultConnectionPName"
:
"MySql.Data.MySqlClient"
},
//是否开启Chrome
[
1
-开启,
0
-关闭
]
...
...
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