Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Test.WebDriver
Project
Overview
Details
Activity
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
示例代码
Kivii.Test.WebDriver
Commits
a4846853
Commit
a4846853
authored
Nov 10, 2023
by
施晓雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新示例
parent
42609465
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
158 additions
and
51 deletions
+158
-51
FrmMain.Designer.cs
FrmMain.Designer.cs
+31
-19
FrmMain.cs
FrmMain.cs
+13
-9
Kivii.Test.WebDriver.csproj
Kivii.Test.WebDriver.csproj
+3
-2
MofcomTest.cs
Tests/MofcomTest.cs
+82
-0
MouseTest.cs
Tests/MouseTest.cs
+14
-14
WeatherTest.cs
Tests/WeatherTest.cs
+14
-6
packages.config
packages.config
+1
-1
No files found.
FrmMain.Designer.cs
View file @
a4846853
...
...
@@ -36,6 +36,7 @@
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
cbxRemote
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
groupBox1
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
cbxHidenLocalCommandWindow
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
btnSwitchWindow
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
panel5
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
lblCurrenWindow
=
new
System
.
Windows
.
Forms
.
Label
();
...
...
@@ -79,7 +80,7 @@
this
.
btnMouseDemo
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnActionsDemo
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnActionsJson
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
cbxHidenLocalCommandWindow
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
btnMofcomTest
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
groupBox1
.
SuspendLayout
();
this
.
panel5
.
SuspendLayout
();
this
.
panel2
.
SuspendLayout
();
...
...
@@ -193,6 +194,16 @@
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
Text
=
"基础操作"
;
//
// cbxHidenLocalCommandWindow
//
this
.
cbxHidenLocalCommandWindow
.
AutoSize
=
true
;
this
.
cbxHidenLocalCommandWindow
.
Location
=
new
System
.
Drawing
.
Point
(
163
,
53
);
this
.
cbxHidenLocalCommandWindow
.
Name
=
"cbxHidenLocalCommandWindow"
;
this
.
cbxHidenLocalCommandWindow
.
Size
=
new
System
.
Drawing
.
Size
(
84
,
16
);
this
.
cbxHidenLocalCommandWindow
.
TabIndex
=
15
;
this
.
cbxHidenLocalCommandWindow
.
Text
=
"隐藏命令行"
;
this
.
cbxHidenLocalCommandWindow
.
UseVisualStyleBackColor
=
true
;
//
// btnSwitchWindow
//
this
.
btnSwitchWindow
.
Location
=
new
System
.
Drawing
.
Point
(
238
,
105
);
...
...
@@ -561,7 +572,7 @@
this
.
tpWebScript
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
22
);
this
.
tpWebScript
.
Name
=
"tpWebScript"
;
this
.
tpWebScript
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
3
);
this
.
tpWebScript
.
Size
=
new
System
.
Drawing
.
Size
(
82
6
,
237
);
this
.
tpWebScript
.
Size
=
new
System
.
Drawing
.
Size
(
82
0
,
237
);
this
.
tpWebScript
.
TabIndex
=
1
;
this
.
tpWebScript
.
Tag
=
"web"
;
this
.
tpWebScript
.
Text
=
"网页内执行"
;
...
...
@@ -573,7 +584,7 @@
this
.
rtbWebScript
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
rtbWebScript
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
rtbWebScript
.
Name
=
"rtbWebScript"
;
this
.
rtbWebScript
.
Size
=
new
System
.
Drawing
.
Size
(
8
20
,
211
);
this
.
rtbWebScript
.
Size
=
new
System
.
Drawing
.
Size
(
8
14
,
211
);
this
.
rtbWebScript
.
TabIndex
=
11
;
this
.
rtbWebScript
.
Text
=
""
;
//
...
...
@@ -583,13 +594,13 @@
this
.
panel1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Bottom
;
this
.
panel1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
214
);
this
.
panel1
.
Name
=
"panel1"
;
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
8
20
,
20
);
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
8
14
,
20
);
this
.
panel1
.
TabIndex
=
10
;
//
// btnWindowExecuteScript
//
this
.
btnWindowExecuteScript
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Right
;
this
.
btnWindowExecuteScript
.
Location
=
new
System
.
Drawing
.
Point
(
7
45
,
0
);
this
.
btnWindowExecuteScript
.
Location
=
new
System
.
Drawing
.
Point
(
7
39
,
0
);
this
.
btnWindowExecuteScript
.
Name
=
"btnWindowExecuteScript"
;
this
.
btnWindowExecuteScript
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
20
);
this
.
btnWindowExecuteScript
.
TabIndex
=
5
;
...
...
@@ -603,7 +614,7 @@
this
.
tpActionJson
.
Controls
.
Add
(
this
.
panel4
);
this
.
tpActionJson
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
22
);
this
.
tpActionJson
.
Name
=
"tpActionJson"
;
this
.
tpActionJson
.
Size
=
new
System
.
Drawing
.
Size
(
82
6
,
237
);
this
.
tpActionJson
.
Size
=
new
System
.
Drawing
.
Size
(
82
0
,
237
);
this
.
tpActionJson
.
TabIndex
=
2
;
this
.
tpActionJson
.
Text
=
"Action自动化测试"
;
this
.
tpActionJson
.
UseVisualStyleBackColor
=
true
;
...
...
@@ -614,12 +625,13 @@
this
.
rtbActionsJson
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
rtbActionsJson
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
rtbActionsJson
.
Name
=
"rtbActionsJson"
;
this
.
rtbActionsJson
.
Size
=
new
System
.
Drawing
.
Size
(
82
6
,
217
);
this
.
rtbActionsJson
.
Size
=
new
System
.
Drawing
.
Size
(
82
0
,
217
);
this
.
rtbActionsJson
.
TabIndex
=
13
;
this
.
rtbActionsJson
.
Text
=
""
;
//
// panel4
//
this
.
panel4
.
Controls
.
Add
(
this
.
btnMofcomTest
);
this
.
panel4
.
Controls
.
Add
(
this
.
btnShowActionsTip
);
this
.
panel4
.
Controls
.
Add
(
this
.
btnMouseDemo
);
this
.
panel4
.
Controls
.
Add
(
this
.
btnActionsDemo
);
...
...
@@ -627,7 +639,7 @@
this
.
panel4
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Bottom
;
this
.
panel4
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
217
);
this
.
panel4
.
Name
=
"panel4"
;
this
.
panel4
.
Size
=
new
System
.
Drawing
.
Size
(
82
6
,
20
);
this
.
panel4
.
Size
=
new
System
.
Drawing
.
Size
(
82
0
,
20
);
this
.
panel4
.
TabIndex
=
12
;
//
// btnShowActionsTip
...
...
@@ -666,7 +678,7 @@
// btnActionsJson
//
this
.
btnActionsJson
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Right
;
this
.
btnActionsJson
.
Location
=
new
System
.
Drawing
.
Point
(
7
51
,
0
);
this
.
btnActionsJson
.
Location
=
new
System
.
Drawing
.
Point
(
7
45
,
0
);
this
.
btnActionsJson
.
Name
=
"btnActionsJson"
;
this
.
btnActionsJson
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
20
);
this
.
btnActionsJson
.
TabIndex
=
5
;
...
...
@@ -674,17 +686,16 @@
this
.
btnActionsJson
.
UseVisualStyleBackColor
=
true
;
this
.
btnActionsJson
.
Click
+=
new
System
.
EventHandler
(
this
.
btnActionsJson_Click
);
//
//
cbxHidenLocalCommandWindow
//
btnMofcomTest
//
this
.
cbxHidenLocalCommandWindow
.
AutoSize
=
true
;
this
.
cbxHidenLocalCommandWindow
.
Checked
=
true
;
this
.
cbxHidenLocalCommandWindow
.
CheckState
=
System
.
Windows
.
Forms
.
CheckState
.
Checked
;
this
.
cbxHidenLocalCommandWindow
.
Location
=
new
System
.
Drawing
.
Point
(
163
,
53
);
this
.
cbxHidenLocalCommandWindow
.
Name
=
"cbxHidenLocalCommandWindow"
;
this
.
cbxHidenLocalCommandWindow
.
Size
=
new
System
.
Drawing
.
Size
(
84
,
16
);
this
.
cbxHidenLocalCommandWindow
.
TabIndex
=
15
;
this
.
cbxHidenLocalCommandWindow
.
Text
=
"隐藏命令行"
;
this
.
cbxHidenLocalCommandWindow
.
UseVisualStyleBackColor
=
true
;
this
.
btnMofcomTest
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Left
;
this
.
btnMofcomTest
.
Location
=
new
System
.
Drawing
.
Point
(
216
,
0
);
this
.
btnMofcomTest
.
Name
=
"btnMofcomTest"
;
this
.
btnMofcomTest
.
Size
=
new
System
.
Drawing
.
Size
(
72
,
20
);
this
.
btnMofcomTest
.
TabIndex
=
17
;
this
.
btnMofcomTest
.
Text
=
"Mofcom"
;
this
.
btnMofcomTest
.
UseVisualStyleBackColor
=
true
;
this
.
btnMofcomTest
.
Click
+=
new
System
.
EventHandler
(
this
.
btnMofcomTest_Click
);
//
// FrmMain
//
...
...
@@ -769,6 +780,7 @@
private
System
.
Windows
.
Forms
.
ComboBox
cbWindows
;
private
System
.
Windows
.
Forms
.
Button
btnSwitchWindow
;
private
System
.
Windows
.
Forms
.
CheckBox
cbxHidenLocalCommandWindow
;
private
System
.
Windows
.
Forms
.
Button
btnMofcomTest
;
}
}
FrmMain.cs
View file @
a4846853
...
...
@@ -295,7 +295,7 @@ namespace Kivii.Test.WebDriver
/// <param name="e"></param>
private
void
btnNavigate_Click
(
object
sender
,
EventArgs
e
)
{
_manager
?.
CurrentWindow
.
Navigate
To
(
tbxUrl
.
Text
);
_manager
?.
CurrentWindow
.
Go
To
(
tbxUrl
.
Text
);
}
/// <summary>
...
...
@@ -341,9 +341,9 @@ namespace Kivii.Test.WebDriver
/// <param name="e"></param>
private
void
btnShowActionsTip_Click
(
object
sender
,
EventArgs
e
)
{
foreach
(
var
actionAttribute
in
ActionBase
.
GetActionAttribute
s
())
foreach
(
var
actionAttribute
in
ActionBase
.
AllAction
s
())
{
appendMsg
(
$"
{
actionAttribute
.
Type
.
FullName
}{
Environment
.
NewLine
}
别名:\"
{
actionAttribute
.
Alias
}
\"
描述:
{
actionAttribute
.
Description
}
"
);
appendMsg
(
$"
{
actionAttribute
.
Type
.
FullName
}{
Environment
.
NewLine
}
别名:\"
{
actionAttribute
.
Alias
}
\"
名称:
{
actionAttribute
.
Name
}{
Environment
.
NewLine
}
描述:
{
actionAttribute
.
Description
}
"
);
}
}
private
void
cbWindows_Enter
(
object
sender
,
EventArgs
e
)
...
...
@@ -408,11 +408,9 @@ namespace Kivii.Test.WebDriver
private
void
btnActionsJson_Click
(
object
sender
,
EventArgs
e
)
{
if
(
_manager
==
null
)
return
;
_manager
.
Maximize
();
//最大化网页
var
window
=
new
Window
(
_manager
);
window
.
ImportActions
(
rtbActionsJson
.
Text
);
var
rtns
=
window
.
ExecuteActions
();
_manager
.
CurrentWindow
.
ImportActions
(
rtbActionsJson
.
Text
);
var
rtns
=
_manager
.
CurrentWindow
.
ExecuteActions
();
appendMsg
(
$"执行结果:
{
Environment
.
NewLine
}{
rtns
}
"
);
}
...
...
@@ -427,8 +425,8 @@ namespace Kivii.Test.WebDriver
/// <param name="e"></param>
private
void
btnActionsDemo_Click
(
object
sender
,
EventArgs
e
)
{
var
a
utoPage
=
WeatherTest
.
Get
();
var
json
=
a
utoPage
.
ExportActions
(
true
);
var
a
ctions
=
WeatherTest
.
GetActions
();
var
json
=
a
ctions
.
ExportActions
(
true
);
rtbActionsJson
.
Text
=
json
;
}
/// <summary>
...
...
@@ -442,6 +440,12 @@ namespace Kivii.Test.WebDriver
var
json
=
autoPage
.
ExportActions
(
true
);
rtbActionsJson
.
Text
=
json
;
}
private
void
btnMofcomTest_Click
(
object
sender
,
EventArgs
e
)
{
var
autoPage
=
MofcomTest
.
Get
();
var
json
=
autoPage
.
ExportActions
(
true
);
rtbActionsJson
.
Text
=
json
;
}
...
...
Kivii.Test.WebDriver.csproj
View file @
a4846853
...
...
@@ -35,8 +35,8 @@
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"Kivii.WebDriver.V4.7, Version=4.15.2023.110
4
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
packages\Kivii.WebDriver.4.15.2023.110
4
0\lib\net47\Kivii.WebDriver.V4.7.dll
</HintPath>
<Reference
Include=
"Kivii.WebDriver.V4.7, Version=4.15.2023.110
5
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
packages\Kivii.WebDriver.4.15.2023.110
5
0\lib\net47\Kivii.WebDriver.V4.7.dll
</HintPath>
</Reference>
<Reference
Include=
"Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"
>
<HintPath>
packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
</HintPath>
...
...
@@ -68,6 +68,7 @@
</Compile>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"Tests\MofcomTest.cs"
/>
<Compile
Include=
"Tests\MouseTest.cs"
/>
<Compile
Include=
"Tests\ReferenceTest.cs"
/>
<Compile
Include=
"Tests\WeatherTest.cs"
/>
...
...
Tests/MofcomTest.cs
0 → 100644
View file @
a4846853
using
Kivii.WebDriver
;
using
Kivii.WebDriver.Actions
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Kivii.Test.WebDriver.Tests
{
internal
class
MofcomTest
{
public
static
Window
Get
()
{
var
rtns
=
new
Window
(
null
);
#
region
打开网站,放在
Action
中执行了,不需要设
autoPage
.
Url
了
{
var
action
=
new
NavigateAction
();
action
.
Name
=
"跳转网站"
;
action
.
Url
=
"http://www.cacs.mofcom.gov.cn/cacscms/view/notice/zhtbomrasff#"
;
rtns
.
Actions
.
Add
(
action
);
}
#
endregion
#
region
暂停
2
秒
{
var
action
=
new
SleepAction
();
action
.
PauseMilliseconds
=
2000
;
rtns
.
Actions
.
Add
(
action
);
}
#
endregion
#
region
移动鼠标至第
1
个元素上点击
{
var
action
=
new
ClickAction
();
action
.
Target
=
new
ElementFinder
(
"//*[@id=\"zhtbomrasff\"]"
);
rtns
.
Actions
.
Add
(
action
);
}
#
endregion
#
region
暂停
2
秒
{
var
action
=
new
SleepAction
();
action
.
Name
=
"准备抓取网页"
;
action
.
PauseMilliseconds
=
2000
;
rtns
.
Actions
.
Add
(
action
);
}
#
endregion
#
region
抓取内容
{
var
action
=
new
JavascriptAction
();
action
.
Script
=
"return '抓取当前页内容'"
;
rtns
.
Actions
.
Add
(
action
);
}
#
endregion
#
region
点击下一页
{
var
action
=
new
ClickAction
();
action
.
Target
=
new
ElementFinder
()
{
Type
=
ElementFindType
.
LinkText
,
Selector
=
"下一页"
};
rtns
.
Actions
.
Add
(
action
);
}
#
endregion
#
region
循环
10
页
{
var
action
=
new
LoopAction
();
action
.
LoopTimes
=
10
;
action
.
FromName
=
"准备抓取网页"
;
rtns
.
Actions
.
Add
(
action
);
}
#
endregion
return
rtns
;
}
}
}
Tests/MouseTest.cs
View file @
a4846853
...
...
@@ -21,7 +21,7 @@ namespace Kivii.Test.WebDriver.Tests
var
action
=
new
NavigateAction
();
action
.
Name
=
"跳转网站"
;
action
.
Url
=
"http://www.cacs.mofcom.gov.cn/cacscms/view/notice/zhtbomrasff#"
;
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -29,8 +29,8 @@ namespace Kivii.Test.WebDriver.Tests
{
var
action
=
new
MouseAction
();
action
.
Type
=
MouseActionType
.
Pause
;
action
.
Duration
Milliseconds
=
2000
;
rtns
.
A
ddAction
(
action
);
action
.
Pause
Milliseconds
=
2000
;
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -39,7 +39,7 @@ namespace Kivii.Test.WebDriver.Tests
var
action
=
new
MouseAction
();
action
.
Type
=
MouseActionType
.
Click
;
action
.
Target
=
new
ElementFinder
(
"//*[@id=\"zhtbomrasff\"]"
);
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -47,8 +47,8 @@ namespace Kivii.Test.WebDriver.Tests
{
var
action
=
new
MouseAction
();
action
.
Type
=
MouseActionType
.
Pause
;
action
.
Duration
Milliseconds
=
2000
;
rtns
.
A
ddAction
(
action
);
action
.
Pause
Milliseconds
=
2000
;
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -57,7 +57,7 @@ namespace Kivii.Test.WebDriver.Tests
var
action
=
new
MouseAction
();
action
.
Type
=
MouseActionType
.
Click
;
action
.
Target
=
new
ElementFinder
(
"//*[@id=\"zhtbomrapex\"]"
);
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -65,8 +65,8 @@ namespace Kivii.Test.WebDriver.Tests
{
var
action
=
new
MouseAction
();
action
.
Type
=
MouseActionType
.
Pause
;
action
.
Duration
Milliseconds
=
2000
;
rtns
.
A
ddAction
(
action
);
action
.
Pause
Milliseconds
=
2000
;
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -75,7 +75,7 @@ namespace Kivii.Test.WebDriver.Tests
var
action
=
new
MouseAction
();
action
.
Type
=
MouseActionType
.
Click
;
action
.
Target
=
new
ElementFinder
(
"//*[@id=\"zhtbmg\"]"
);
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -83,8 +83,8 @@ namespace Kivii.Test.WebDriver.Tests
{
var
action
=
new
MouseAction
();
action
.
Type
=
MouseActionType
.
Pause
;
action
.
Duration
Milliseconds
=
2000
;
rtns
.
A
ddAction
(
action
);
action
.
Pause
Milliseconds
=
2000
;
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -93,7 +93,7 @@ namespace Kivii.Test.WebDriver.Tests
var
action
=
new
MouseAction
();
action
.
Type
=
MouseActionType
.
Click
;
action
.
Target
=
new
ElementFinder
(
"//*[@id=\"zhtbomrasff\"]"
);
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -101,7 +101,7 @@ namespace Kivii.Test.WebDriver.Tests
{
var
action
=
new
MouseAction
();
action
.
Type
=
MouseActionType
.
Perform
;
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
return
rtns
;
...
...
Tests/WeatherTest.cs
View file @
a4846853
...
...
@@ -10,17 +10,25 @@ namespace Kivii.Test.WebDriver.Tests
{
internal
class
WeatherTest
{
public
static
Window
Get
()
public
static
Window
Get
Actions
()
{
var
rtns
=
new
Window
(
null
);
//autoPage.Url = "https://www.baidu.com";//生成DEMO时不需要
#
region
导航到
Baidu
{
var
action
=
new
NavigateAction
();
action
.
Url
=
"https://www.baidu.com"
;
rtns
.
Actions
.
Add
(
action
);
}
#
endregion
#
region
第一步,在输入框内输入内容
{
var
action
=
new
InputAction
();
action
.
Name
=
"输入查询内容"
;
action
.
InputValue
=
"最近天气"
;
action
.
Target
=
new
ElementFinder
(
"kw"
,
"id"
);
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -29,7 +37,7 @@ namespace Kivii.Test.WebDriver.Tests
var
action
=
new
ClickAction
();
action
.
Name
=
"百度一下"
;
action
.
Target
=
new
ElementFinder
(
"su"
,
"id"
);
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -40,7 +48,7 @@ namespace Kivii.Test.WebDriver.Tests
//使用XPath
action
.
Target
=
new
ElementFinder
(
"/html/body/div[3]/div[3]/div[1]/div[3]/div[1]/div/div/div[1]/div/div[1]/div[2]/div[1]/div[1]/div/div[1]"
);
action
.
Attributes
.
Add
(
"innerText"
,
"所在城市"
);
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -51,7 +59,7 @@ namespace Kivii.Test.WebDriver.Tests
//使用XPath
action
.
Target
=
new
ElementFinder
(
".weather-main-temp_6CEpK > span:nth-child(1)"
,
"css"
);
action
.
Attributes
.
Add
(
"innerText"
,
"天气"
);
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
...
...
@@ -61,7 +69,7 @@ namespace Kivii.Test.WebDriver.Tests
action
.
Name
=
"测试JS返回"
;
//使用XPath
action
.
Js
=
"return '测试JS返回';"
;
rtns
.
A
ddAction
(
action
);
rtns
.
A
ctions
.
Add
(
action
);
}
#
endregion
return
rtns
;
...
...
packages.config
View file @
a4846853
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"Kivii.WebDriver"
version
=
"4.15.2023.110
4
0"
targetFramework
=
"net472"
/>
<
package
id
=
"Kivii.WebDriver"
version
=
"4.15.2023.110
5
0"
targetFramework
=
"net472"
/>
<
package
id
=
"Newtonsoft.Json"
version
=
"13.0.1"
targetFramework
=
"net472"
/>
<
package
id
=
"Selenium.Support"
version
=
"4.15.0"
targetFramework
=
"net472"
/>
<
package
id
=
"Selenium.WebDriver"
version
=
"4.15.0"
targetFramework
=
"net472"
/>
...
...
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