gogo_driver 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -5
- data/.travis.yml +1 -1
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +1 -2
- data/LICENSE.txt +17 -18
- data/README.md +2 -3
- data/Rakefile +5 -4
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/gogo_driver +3 -0
- data/gogo_driver.gemspec +10 -7
- data/lib/gogo_driver.rb +37 -11
- metadata +14 -16
- data/.rspec +0 -2
- data/lib/gogo_driver/entity.rb +0 -54
- data/lib/gogo_driver/version.rb +0 -3
- data/spec/gogo_driver_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49f77e06484158676215a3d8d2ee049402b67769
|
4
|
+
data.tar.gz: 588c2beebc576c6d272d1406215a0fbbcac6d1b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71f8d94a67aeca61eef82e4e934ce34f0f43ffdfff4a82feb78c31eb618ec1f28c6dd1b1f35603a8f00f10959ee3deba4b5bdd1795af2644f322d591ca3cca28
|
7
|
+
data.tar.gz: be551eb77e567a1dcd32d88419f3b87640efadd6400189c5ea275adeebafaa44a0c99d7e406df60a401836a8c113908acfa8f403c5f63f7d8cbc70b8ef24ebe4
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2015 gogotanaka
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
12
11
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
15
14
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -6,10 +6,10 @@ Super simple web driver.
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
[1] Install gem as you like.
|
9
|
+
[1] Install gem as you like.
|
10
10
|
|
11
11
|
$ gem install gogo_driver
|
12
|
-
|
12
|
+
|
13
13
|
[2] Install chromedriver. Below is the MacOS example.
|
14
14
|
|
15
15
|
$ brew install chromedriver
|
@@ -33,4 +33,3 @@ else
|
|
33
33
|
# ログイン成功時の処理
|
34
34
|
end
|
35
35
|
```
|
36
|
-
|
data/Rakefile
CHANGED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gogo_driver"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/gogo_driver
ADDED
data/gogo_driver.gemspec
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'gogo_driver/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "gogo_driver"
|
8
|
-
spec.version =
|
7
|
+
spec.version = "0.1.0"
|
9
8
|
spec.authors = ["gogotanaka"]
|
10
9
|
spec.email = ["mail@tanakakazuki.com"]
|
11
10
|
spec.summary = %q{Super simple web driver.}
|
@@ -13,14 +12,18 @@ Gem::Specification.new do |spec|
|
|
13
12
|
spec.homepage = ""
|
14
13
|
spec.license = "MIT"
|
15
14
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^
|
18
|
-
spec.
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
|
+
spec.bindir = "exe"
|
19
18
|
spec.require_paths = ["lib"]
|
20
19
|
|
20
|
+
# if spec.respond_to?(:metadata)
|
21
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
|
22
|
+
# end
|
23
|
+
|
21
24
|
spec.add_dependency "selenium-webdriver"
|
22
25
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
24
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
-
spec.add_development_dependency "
|
28
|
+
spec.add_development_dependency "minitest"
|
26
29
|
end
|
data/lib/gogo_driver.rb
CHANGED
@@ -1,19 +1,45 @@
|
|
1
|
-
require
|
2
|
-
require "gogo_driver/entity"
|
1
|
+
require 'selenium-webdriver'
|
3
2
|
|
4
3
|
class GogoDriver
|
5
|
-
attr_accessor :
|
4
|
+
attr_accessor :driver
|
6
5
|
|
7
|
-
def initialize
|
8
|
-
@
|
9
|
-
|
10
|
-
|
6
|
+
def initialize
|
7
|
+
@driver = Selenium::WebDriver.for(:chrome)
|
8
|
+
end
|
9
|
+
|
10
|
+
def go(url)
|
11
|
+
@driver.navigate.to(url)
|
12
|
+
end
|
13
|
+
|
14
|
+
def reload
|
15
|
+
@driver.navigate.refresh
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(selector)
|
19
|
+
@driver.find_element(css: selector)
|
20
|
+
end
|
21
|
+
|
22
|
+
def has?(selector)
|
23
|
+
!!find(selector)
|
24
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def has_text?(text)
|
29
|
+
!!@driver.find_element({xpath: "//*[text()[contains(.,\"#{text}\")]]"})
|
30
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
31
|
+
false
|
32
|
+
end
|
33
|
+
|
34
|
+
def click(selector)
|
35
|
+
has?(selector) ? find(selector).click : false
|
36
|
+
end
|
37
|
+
|
38
|
+
def submit
|
39
|
+
$focus.submit if $focus
|
11
40
|
end
|
12
41
|
|
13
42
|
def method_missing(method, *args, &block)
|
14
|
-
@
|
15
|
-
rescue Errno::ECONNREFUSED
|
16
|
-
initialize(@last_url)
|
17
|
-
@entity.send(method, *args, &block)
|
43
|
+
@driver.respond_to?(method) ? @driver.send(method, *args, &block) : super
|
18
44
|
end
|
19
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gogo_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gogotanaka
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.9'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -69,23 +69,23 @@ dependencies:
|
|
69
69
|
description: Super simple web driver.
|
70
70
|
email:
|
71
71
|
- mail@tanakakazuki.com
|
72
|
-
executables:
|
72
|
+
executables:
|
73
|
+
- gogo_driver
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files: []
|
75
76
|
files:
|
76
77
|
- ".gitignore"
|
77
|
-
- ".rspec"
|
78
78
|
- ".travis.yml"
|
79
|
+
- CODE_OF_CONDUCT.md
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE.txt
|
81
82
|
- README.md
|
82
83
|
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- exe/gogo_driver
|
83
87
|
- gogo_driver.gemspec
|
84
88
|
- lib/gogo_driver.rb
|
85
|
-
- lib/gogo_driver/entity.rb
|
86
|
-
- lib/gogo_driver/version.rb
|
87
|
-
- spec/gogo_driver_spec.rb
|
88
|
-
- spec/spec_helper.rb
|
89
89
|
homepage: ''
|
90
90
|
licenses:
|
91
91
|
- MIT
|
@@ -106,10 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.4.5
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Super simple web driver.
|
113
|
-
test_files:
|
114
|
-
- spec/gogo_driver_spec.rb
|
115
|
-
- spec/spec_helper.rb
|
113
|
+
test_files: []
|
data/.rspec
DELETED
data/lib/gogo_driver/entity.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'selenium-webdriver'
|
2
|
-
|
3
|
-
class GogoDriver
|
4
|
-
class Entity
|
5
|
-
attr_accessor :driver
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@driver = Selenium::WebDriver.for(:chrome)
|
9
|
-
end
|
10
|
-
|
11
|
-
def go(url)
|
12
|
-
@driver.navigate.to(url)
|
13
|
-
end
|
14
|
-
|
15
|
-
def reload
|
16
|
-
@driver.navigate.refresh
|
17
|
-
end
|
18
|
-
|
19
|
-
def find(selector)
|
20
|
-
@driver.find_element(css: selector)
|
21
|
-
end
|
22
|
-
|
23
|
-
def finds(selector)
|
24
|
-
@driver.find_elements(css: selector)
|
25
|
-
end
|
26
|
-
|
27
|
-
def has?(selector)
|
28
|
-
!!find(selector)
|
29
|
-
rescue Selenium::WebDriver::Error::NoSuchElementError
|
30
|
-
false
|
31
|
-
end
|
32
|
-
|
33
|
-
def has_text?(text)
|
34
|
-
!!@driver.find_element({xpath: "//*[text()[contains(.,\"#{text}\")]]"})
|
35
|
-
rescue Selenium::WebDriver::Error::NoSuchElementError
|
36
|
-
false
|
37
|
-
end
|
38
|
-
|
39
|
-
def click(selector)
|
40
|
-
has?(selector) ? find(selector).click : false
|
41
|
-
end
|
42
|
-
|
43
|
-
def submit
|
44
|
-
$focus.submit if $focus
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class Selenium::WebDriver::Element
|
50
|
-
def fill(text)
|
51
|
-
$focus = self
|
52
|
-
send_key(text)
|
53
|
-
end
|
54
|
-
end
|
data/lib/gogo_driver/version.rb
DELETED
data/spec/gogo_driver_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED