lib/pwn/www/pandora.rb in pwn-0.4.701 vs lib/pwn/www/pandora.rb in pwn-0.4.702

- old
+ new

@@ -13,11 +13,12 @@ # ) public_class_method def self.open(opts = {}) browser_obj = PWN::Plugins::TransparentBrowser.open(opts) - browser_obj.goto('https://www.pandora.com') + browser = browser_obj[:browser] + browser.goto('https://www.pandora.com') browser_obj rescue StandardError => e raise e end @@ -32,21 +33,23 @@ public_class_method def self.login(opts = {}) browser_obj = opts[:browser_obj] username = opts[:username].to_s.scrub.strip.chomp password = opts[:password] + browser = browser_obj[:browser] + if password.nil? password = PWN::Plugins::AuthenticationHelper.mask_password else password = opts[:password].to_s.scrub.strip.chomp end - browser_obj.goto('https://www.pandora.com/account/sign-in') + browser.goto('https://www.pandora.com/account/sign-in') - browser_obj.text_field(id: 'login_username').wait_until(&:present?).set(username) - browser_obj.text_field(id: 'login_password').wait_until(&:present?).set(password) - browser_obj.button(text: 'Log In').click! + browser.text_field(id: 'login_username').wait_until(&:present?).set(username) + browser.text_field(id: 'login_password').wait_until(&:present?).set(password) + browser.button(text: 'Log In').click! browser_obj rescue StandardError => e raise e end @@ -56,13 +59,15 @@ # browser_obj: 'required - browser_obj returned from #open method' # ) public_class_method def self.logout(opts = {}) browser_obj = opts[:browser_obj] - browser_obj.img(alt: 'Account Menu').wait_until(&:present?).click! - browser_obj.span(text: 'Sign Out').wait_until(&:present?).click! + browser = browser_obj[:browser] + browser.img(alt: 'Account Menu').wait_until(&:present?).click! + browser.span(text: 'Sign Out').wait_until(&:present?).click! + browser_obj rescue StandardError => e raise e end @@ -94,10 +99,11 @@ puts "USAGE: browser_obj = #{self}.open( browser_type: 'optional - :firefox|:chrome|:ie|:headless (Defaults to :firefox)', proxy: 'optional - scheme://proxy_host:port || tor' ) - puts browser_obj.public_methods + browser = browser_obj[:browser] + puts browser.public_methods browser_obj = #{self}.login( browser_obj: 'required - browser_obj returned from #open method', username: 'required - username', password: 'optional - passwd (will prompt if blank),