selenium_standalone_dsl 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dae05766cf64fc31e2f4077e1bde3ccc939f9d86
4
- data.tar.gz: 0d1d23106b80832857882680767afad024b70587
3
+ metadata.gz: d2ecd8f0c3f3f8f7f31a888efdff7b31720419f8
4
+ data.tar.gz: 35cf1473f2b15d289cbc8d029961f5c8cfd7d3a7
5
5
  SHA512:
6
- metadata.gz: f48e42c2fb25468467c6a7f694cad55a673b1b94ea643b4b105d8955c6d65ba33f660578333351ee53c564866dcbf6fb81cabb8a35a1783bc044d913d53d9a54
7
- data.tar.gz: 42540bd565063aa36f2ec1954f940236fa9e3f818d7d642803fa22b758a0461421f24a667a8250c80d748fc234cbb3e7a7b644c89b58ad3dba93000fcd24bb75
6
+ metadata.gz: a95e03119bf96fa0f103e72f2cfb2a17370577fddc347e0328f8878c4e5eb23e1b1b8c5fbecd0cdf8a80998e84fd10ff799c23d0e5616afe31dffca9b867ebaa
7
+ data.tar.gz: feccbd3e35174096e188c80ee19b9f50da4ba3ccdc44d857b92f0b44755925c3633480339f3af1eaadc7b8af696db86bf0a6ea38af709baf5249497faee035bd
data/Gemfile CHANGED
@@ -12,3 +12,5 @@ group :development, :staging do
12
12
  gem 'sinatra'
13
13
  end
14
14
 
15
+ gemspec
16
+
data/Gemfile.lock CHANGED
@@ -1,3 +1,8 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ selenium_standalone_dsl (0.1.1)
5
+
1
6
  GEM
2
7
  remote: https://rubygems.org/
3
8
  specs:
@@ -63,12 +68,14 @@ PLATFORMS
63
68
 
64
69
  DEPENDENCIES
65
70
  activesupport
71
+ bundler (~> 1.12)
66
72
  headless
67
73
  nokogiri
68
74
  pry
69
75
  rake
70
76
  rspec
71
77
  selenium-webdriver
78
+ selenium_standalone_dsl!
72
79
  sinatra
73
80
 
74
81
  BUNDLED WITH
data/README.md CHANGED
@@ -1,9 +1,23 @@
1
+ [![Gem Version](https://badge.fury.io/rb/selenium_standalone_dsl.svg)](https://badge.fury.io/rb/selenium_standalone_dsl)
2
+
1
3
  # SeleniumStandaloneDsl
2
4
 
3
5
  Gem for using Selenium webdriver simply.
4
6
 
5
7
  ## Installation
6
8
 
9
+ Ensure you already install Firefox:
10
+
11
+ ```sh
12
+ sudo apt-get install firefox
13
+ ```
14
+
15
+ If you want to run firefox headlessly, install Xvfb:
16
+
17
+ ```sh
18
+ sudo apt-get install xvfb
19
+ ```
20
+
7
21
  Add this line to your application's Gemfile:
8
22
 
9
23
  ```ruby
@@ -12,21 +26,61 @@ gem 'selenium_standalone_dsl'
12
26
 
13
27
  And then execute:
14
28
 
15
- $ bundle
29
+ ```sh
30
+ bundle
31
+ ```
16
32
 
17
33
  Or install it yourself as:
18
34
 
19
- $ gem install selenium_standalone_dsl
35
+ ```sh
36
+ gem install selenium_standalone_dsl
37
+ ```
20
38
 
21
39
  ## Usage
22
40
 
23
- (Coming soon)
41
+ ```rb
42
+ class YahooSearcher < SeleniumStandaloneDsl::Base
43
+ def search_for_wikipedia
44
+ visit 'https://www.yahoo.com/'
45
+ fill_in 'p', with: 'wikipedia'
24
46
 
25
- ## Development
47
+ # You can declare how to find elements: [class|id|css|xpath]
48
+ click 'IconNavSearch', find_by: :class
26
49
 
27
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
+ if has_element? :text, 'Next'
51
+ click 'Next'
52
+ end
28
53
 
29
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
54
+ # You can use full jQuery CSS selector using 'search'
55
+ puts search('span:contains("results")').inner_text
56
+ end
57
+ end
58
+
59
+ config = {
60
+ log_path: '/tmp/selenium_standalone_dsl.log',
61
+ user_agent: 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 ' +
62
+ '(KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36',
63
+ headless: true,
64
+ }
65
+
66
+ driver = YahooSearcher.new(config)
67
+ driver.search_for_wikipedia
68
+
69
+ # => 141,000,000 results
70
+
71
+ ```
72
+
73
+ ## Development
74
+
75
+ ```sh
76
+ git clone git@github.com:acro5piano/selenium_standalone_dsl.git
77
+ cd selenium_standalone_dsl
78
+ bundle install --path vendor/bundle
79
+ bundle exec rake install
80
+ bundle exec rake spec
81
+ ```
82
+
83
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
84
 
31
85
  ## Contributing
32
86
 
data/demo.rb ADDED
@@ -0,0 +1,29 @@
1
+ require 'bundler/setup'
2
+ require 'selenium_standalone_dsl'
3
+
4
+ class YahooSearcher < SeleniumStandaloneDsl::Base
5
+ def search_for_wikipedia
6
+ visit 'https://www.yahoo.com/'
7
+ fill_in 'p', with: 'wikipedia'
8
+
9
+ # You can declare how to find elements: [class|id|css|xpath]
10
+ click 'IconNavSearch', find_by: :class
11
+
12
+ if has_element? :text, 'Next'
13
+ click 'Next'
14
+ end
15
+
16
+ # You can use full jQuery CSS selector using 'search'
17
+ puts search('span:contains("results")').inner_text
18
+ end
19
+ end
20
+
21
+ config = {
22
+ log_path: '/tmp/selenium_standalone_dsl.log',
23
+ user_agent: 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 ' +
24
+ '(KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36',
25
+ headless: true,
26
+ }
27
+
28
+ driver = YahooSearcher.new(config)
29
+ driver.search_for_wikipedia
@@ -1,3 +1,3 @@
1
1
  module SeleniumStandaloneDsl
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium_standalone_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - gosho-kazuya
@@ -69,6 +69,7 @@ files:
69
69
  - LICENSE
70
70
  - README.md
71
71
  - Rakefile
72
+ - demo.rb
72
73
  - lib/selenium_standalone_dsl.rb
73
74
  - lib/selenium_standalone_dsl/base.rb
74
75
  - lib/selenium_standalone_dsl/version.rb