Open gartha1 opened 5 years ago
This shows what happens if I use 'next' rather than 'step'.
It doesn't stop at each put statement. (which is what I want to do).
So either way, step or next, it doesn't work or doesn't do what I'd like.
Apples-MBP:aa apple$ ls -l
total 24
-rw-r--r-- 1 apple staff 17 29 Dec 03:52 Gemfile
-rw-r--r-- 1 apple staff 287 29 Dec 03:53 Gemfile.lock
-rw-r--r-- 1 apple staff 490 29 Dec 03:53 pbb_selenium_thing.rb
Apples-MBP:aa apple$ cat Gemfile
gem 'pry-byebug'
Apples-MBP:aa apple$ cat pbb_selenium_thing.rb
# https://stackoverflow.com/questions/53962313/in-ruby-i-cant-get-byebug-to-work-with-selenium?noredirect=1#comment94763217_53962313
require 'selenium-webdriver'
require 'pry'
require 'pry-byebug'
binding.pry
driver = Selenium::WebDriver.for:chrome
driver.navigate.to "http://google.com"
puts driver.find_element(:tag_name, 'input');
puts driver.find_element(:name, 'q');
driver.find_element(:name, 'q').send_keys("asdf");
#sleep 20
Apples-MBP:aa apple$ ruby pbb_selenium_thing.rb
WARN: Unresolved specs during Gem::Specification.reset:
ffi (>= 1.0.11, ~> 1.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
From: /Users/apple/rubyselenium1/aa/pbb_selenium_thing.rb @ line 9 :
4: require 'pry'
5: require 'pry-byebug'
6:
7: binding.pry
8:
=> 9: driver = Selenium::WebDriver.for:chrome
10:
11: driver.navigate.to "http://google.com"
12:
13: puts driver.find_element(:tag_name, 'input');
14: puts driver.find_element(:name, 'q');
[1] pry(main)> next
#<Selenium::WebDriver::Element:0x00007fb4a7bff8e8>
#<Selenium::WebDriver::Element:0x00007fb4a7b0c3c8>
Apples-MBP:aa apple$
I have a similar issue while using pry-byebug with pry-remote on MacOS. If I try to use finish
, step
, or next
, it gets stuck at a call to teardown
in PryRemote::Server#run
[36] pry(#<Admin::VersionsController>)> finish
From: /usr/local/lib/ruby/gems/2.6.0/gems/pry-remote-0.1.8/lib/pry-remote.rb @ line 211 PryRemote::Server#run:
206: def run
207: setup
208:
209: Pry.start(@object, @options.merge(:input => client.input_proxy, :output => client.output))
210: ensure
=> 211: teardown
212: end
When I try using pry-byebug, I find I am unable to step through my code.
It goes into some internal code not written by me, and then gives an error about deadlock.
For anybody unfamiliar with Selenium, it is a library that lets a person programmatically control a web browser. I am using Mac osx. I had to do
$gem install selenium-webdriver
(which I guess you know). And I had to install a chrome web driver which I did with$brew tap homebrew/cask
and$brew cask install chrome driver
. Selenium is running fine for me.The program below demonstrates an issue I'm having with pry-byebug.