girbot 0.2.1 → 0.2.2

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: d8208869111795ba7f2ab5d6ab14ab4903968d82
4
- data.tar.gz: 0bf692a8d6416548ff411fa39fc7e3e3b3537705
3
+ metadata.gz: a44e0e3084ce38b412c17e4ddb1ecbb66ffe0115
4
+ data.tar.gz: de8cd63f2b887aca2f807ffc90972a4bb00b1fcc
5
5
  SHA512:
6
- metadata.gz: 50b29fb9bd655257e06d14ec536087709df2d310ba3887576831ad30fc0fa49547079dd78eb062b444a69fc5fa0443f2c29e46e06d7e8f1924225905800079b3
7
- data.tar.gz: 18c8e40812bb83b9067901b79b1a2973fb105b82c2b03207b5bc02b905ee2b6a2607872ffb6bbbb3a6adf95ccf28894f49e16c0fd3abf647e709cbac06a19e28
6
+ metadata.gz: 76ccd669127366e56c9d8df5134540d51781222709ac84e94859a2aa805a053cdbb42db3f93f1ff6b86b975f004cf1f461e96f8136f766b7629c882bdd9c86c3
7
+ data.tar.gz: 0616e112cb27ea6103cdc8e2878cc12a46e2086c22f40ea9aff540e4ce9924e64c9fb9e8ff43f34880565f1b28472947a1b1a3f9f1e6fdd04005ed3cfbeb50b2
@@ -0,0 +1,30 @@
1
+ FROM ruby:2.4.3
2
+ MAINTAINER mess110
3
+
4
+ # Install Chrome, Xvfb and utility packages (libav for video capture), clean up
5
+ RUN set -ex \
6
+ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
7
+ && sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" \
8
+ >> /etc/apt/sources.list.d/google.list' \
9
+ && apt-get update \
10
+ && apt-get install -y google-chrome-stable libnss3 libgconf-2-4 \
11
+ xvfb unzip libav-tools \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Install Chromedriver
15
+ RUN set -ex \
16
+ && cd /tmp \
17
+ && wget -Nv http://chromedriver.storage.googleapis.com/2.38/chromedriver_linux64.zip \
18
+ && unzip chromedriver_linux64.zip \
19
+ && chmod -v +x chromedriver \
20
+ && mv -v chromedriver /usr/local/bin/ \
21
+ && rm -v chromedriver_linux64.zip
22
+
23
+ RUN gem install girbot -v 0.2.1
24
+
25
+ RUN mkdir /app
26
+ WORKDIR /app
27
+
28
+ VOLUME /app/screenshots
29
+
30
+ EXPOSE 4125
data/README.md CHANGED
@@ -61,6 +61,19 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
61
61
 
62
62
  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).
63
63
 
64
+ ## Docker
65
+
66
+
67
+ ```
68
+ docker pull mess110/girbot
69
+ ```
70
+
71
+ To build locally, clone the repo and:
72
+
73
+ ```
74
+ docker build -t girbot .
75
+ ```
76
+
64
77
  ## Contributing
65
78
 
66
79
  Bug reports and pull requests are welcome on GitHub at https://github.com/mess110/girbot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -0,0 +1,42 @@
1
+ require "bundler/setup"
2
+ require "girbot"
3
+
4
+ browser_holder = Girbot::BrowserHolder.new(:chrome, nil)
5
+
6
+ class TestRun < Girbot::Step
7
+ def action options = {}
8
+ goto "file://#{Dir.pwd}/examples/test_basic.html"
9
+
10
+ text_in_textfield('john doe', id: 'name')
11
+ end
12
+ end
13
+
14
+ class Iframe < Girbot::Step
15
+ def action options = {}
16
+ basic_path = "file://#{Dir.pwd}/examples/test_basic.html"
17
+ goto "file://#{Dir.pwd}/examples/test_iframe.html"
18
+
19
+ exec_js("document.querySelectorAll('iframe')[0].src = '#{basic_path}';")
20
+
21
+ browser.iframes[0].text_field(id: 'name').set 'john doe'
22
+
23
+ loop do
24
+ sleep 1
25
+ end
26
+ end
27
+ end
28
+
29
+
30
+ TestRun.run(
31
+ headless: false,
32
+ openBrowser: true,
33
+ closeBrowser: false,
34
+ browser: browser_holder,
35
+ )
36
+
37
+ Iframe.run(
38
+ headless: false,
39
+ openBrowser: false,
40
+ closeBrowser: false,
41
+ browser: browser_holder,
42
+ )
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width" />
6
+ <title>basic</title>
7
+ </head>
8
+ <body>
9
+ <p>basic</p>
10
+ <input type="text" id="name" />
11
+ </body>
12
+ </html>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width" />
6
+ <title>iframe</title>
7
+ </head>
8
+ <body>
9
+ <p>iframe</p>
10
+ <iframe></iframe>
11
+ </body>
12
+ </html>
@@ -9,6 +9,7 @@ require 'girbot/watir_shortcuts'
9
9
  require 'girbot/browser_holder'
10
10
  require 'girbot/step_foundation'
11
11
  require 'girbot/string_generator'
12
+ require 'girbot/version'
12
13
 
13
14
  require 'girbot/steps/step'
14
15
  require 'girbot/steps/brute_force'
@@ -1,3 +1,3 @@
1
1
  module Girbot
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -32,7 +32,7 @@ module Girbot
32
32
  end
33
33
 
34
34
  def select_value(value, query)
35
- browser.select_list(query).select_value(value)
35
+ browser.select_list(query).select(value)
36
36
  end
37
37
 
38
38
  # Examples:
@@ -53,6 +53,15 @@ module Girbot
53
53
  browser.send(type, query).fire_event event
54
54
  end
55
55
 
56
+ def screenshot(label, preview = false)
57
+ result = browser.screenshot.save "screenshots/screenshot-#{label}-#{Time.now.to_i}.png"
58
+ if preview
59
+ pid = spawn("xdg-open #{result.path}")
60
+ Process.detach(pid)
61
+ end
62
+ result
63
+ end
64
+
56
65
  def close
57
66
  browser.close
58
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: girbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristian Mircea Messel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-07 00:00:00.000000000 Z
11
+ date: 2018-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,6 +136,7 @@ files:
136
136
  - ".ruby-version"
137
137
  - ".travis.yml"
138
138
  - CODE_OF_CONDUCT.md
139
+ - Dockerfile
139
140
  - Gemfile
140
141
  - LICENSE.txt
141
142
  - README.md
@@ -147,7 +148,9 @@ files:
147
148
  - examples/cookie_clicker_firefox.rb
148
149
  - examples/details.json.example
149
150
  - examples/emag_search.rb
150
- - examples/test_run.rb
151
+ - examples/test.rb
152
+ - examples/test_basic.html
153
+ - examples/test_iframe.html
151
154
  - girbot.gemspec
152
155
  - lib/girbot.rb
153
156
  - lib/girbot/browser_holder.rb
@@ -1,18 +0,0 @@
1
- require "bundler/setup"
2
- require "girbot"
3
-
4
- class TestRun < Girbot::Step
5
- def action options = {}
6
- goto 'file:///home/kiki/pr0n/girbot/select.html'
7
-
8
- loop do
9
- sleep 1
10
- end
11
- end
12
- end
13
-
14
- TestRun.run(
15
- headless: false,
16
- closeBrowser: false,
17
- browser: Girbot::BrowserHolder.new(:chrome, nil),
18
- )