Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webmagic
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
沈俊林
webmagic
Commits
895fca9f
Commit
895fca9f
authored
Mar 04, 2017
by
yihua.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复seleniumDownloader配置文件写死的问题 #475
parent
d87c73b4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
pom.xml
webmagic-selenium/pom.xml
+1
-1
WebDriverPool.java
...codecraft/webmagic/downloader/selenium/WebDriverPool.java
+6
-2
config.ini
webmagic-selenium/src/test/resources/config.ini
+11
-0
No files found.
webmagic-selenium/pom.xml
View file @
895fca9f
...
...
@@ -13,7 +13,7 @@
<dependency>
<groupId>
org.seleniumhq.selenium
</groupId>
<artifactId>
selenium-java
</artifactId>
<version>
2.4
6
.0
</version>
<version>
2.4
1
.0
</version>
</dependency>
<dependency>
<groupId>
us.codecraft
</groupId>
...
...
webmagic-selenium/src/main/java/us/codecraft/webmagic/downloader/selenium/WebDriverPool.java
View file @
895fca9f
...
...
@@ -45,7 +45,7 @@ class WebDriverPool {
private
WebDriver
mDriver
=
null
;
private
boolean
mAutoQuitDriver
=
true
;
private
static
final
String
CONFIG_FILE
=
"/Users/Bingo/Documents/workspace
/webmagic/webmagic-selenium/config.ini"
;
private
static
final
String
DEFAULT_CONFIG_FILE
=
"/data
/webmagic/webmagic-selenium/config.ini"
;
private
static
final
String
DRIVER_FIREFOX
=
"firefox"
;
private
static
final
String
DRIVER_CHROME
=
"chrome"
;
private
static
final
String
DRIVER_PHANTOMJS
=
"phantomjs"
;
...
...
@@ -64,7 +64,11 @@ class WebDriverPool {
public
void
configure
()
throws
IOException
{
// Read config file
sConfig
=
new
Properties
();
sConfig
.
load
(
new
FileReader
(
CONFIG_FILE
));
String
configFile
=
DEFAULT_CONFIG_FILE
;
if
(
System
.
getProperty
(
"selenuim_config"
)!=
null
){
configFile
=
System
.
getProperty
(
"selenuim_config"
);
}
sConfig
.
load
(
new
FileReader
(
configFile
));
// Prepare capabilities
sCaps
=
new
DesiredCapabilities
();
...
...
webmagic-selenium/src/test/resources/config.ini
0 → 100644
View file @
895fca9f
#driver=phantomjs
driver
=
firefox
driver
=
chrome
#driver=http://localhost:8910
driver
=
http://localhost:4444/wd/hub
# PhantomJS specific config (change according to your installation)
#phantomjs_exec_path=/Users/detro/bin/phantomjs-qt5
phantomjs_exec_path
=
/Users/detro/bin/phantomjs-upstream
phantomjs_driver_path
=
../../src/main.js
phantomjs_driver_loglevel
=
DEBUG
\ No newline at end of file
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