Ruby
scroll_to('views').click
scroll_to('tabs').click
scroll_to('content by id').click
s_text(0).selected?.must_equal false
s_text(1).selected?.must_equal true| // device name : result | |
| var pairs = $x('//*[@id="by_device"]/div/div/div'); | |
| for (var a = 0, len = pairs.length / 2; a < len; a+=2) { | |
| if (all_passed(pairs[a+1])) { | |
| console.log(device_name(pairs[a])); | |
| } | |
| } | |
| // device name. pairs[0] |
| # code goes in ~/.bash_profile | |
| # tested on OS X | |
| export APPIUM_HOME="$HOME/Desktop/appium" | |
| export TEST_HOME="$HOME/path/to/tests" | |
| export APPIUM_AVD="t18" | |
| function three { | |
| # does node exist? | |
| [[ $(ps axo pid,command | grep "[0-9]\+ node" | wc -l) -gt 0 ]] && \ |
| require 'rubygems' | |
| $at_once = '3' | |
| $total = 6 | |
| ENV['N'] = $at_once | |
| require 'selenium-webdriver' | |
| require 'minitest' | |
| require 'minitest/hell' |
| # gem install nokogiri escape_utils | |
| text = '' | |
| reader = Nokogiri::XML::Reader(File.open(file)) | |
| reader.each do |n| | |
| text += ' ' + n.value + ' ' if n.value? | |
| end | |
| # double unescape | |
| text = EscapeUtils.unescape_html text | |
| text = EscapeUtils.unescape_html text |
Ruby
scroll_to('views').click
scroll_to('tabs').click
scroll_to('content by id').click
s_text(0).selected?.must_equal false
s_text(1).selected?.must_equal true| require 'rubygems' | |
| require 'method_source' | |
| ary = [] | |
| class Test | |
| def self.run &block | |
| define_method :run_method do | |
| # https://www.ruby-forum.com/topic/4416134#1117671 | |
| eval %(ary << 1; puts 'complete'), block.binding |
| # Example of Ruby page object pattern | |
| module App | |
| module Splash | |
| class << self | |
| def login | |
| 'login' | |
| end | |
| end | |
| end |
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:130)
... 20 more
Caused by: java.lang.NoClassDefFoundError: Lorg/sonatype/aether/RepositorySystem;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2397)
at java.lang.Class.getDeclaredFields(Class.java:1806)
at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:661)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:366)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:165)
| <!-- security authorizationdb read system.privilege.taskport > system.privilege.taskport.txt | |
| DevToolsSecurity --enable | |
| security authorizationdb write system.privilege.taskport is-developer | |
| Fix developer popup. | |
| Commands from: https://github.com/appium/appium/pull/1468 | |
| --> | |
| <?xml version="1.0" encoding="UTF-8"?> |
| # Find open webviews on API 19 Android emulator. | |
| def print_webviews | |
| webviews = `adb shell cat /proc/net/unix` | |
| webview_prefix = '@webview_devtools_remote_' | |
| webviews = webviews.split("\r\n").reject { |l| ! l.include?(webview_prefix) } | |
| # one pid may have many webviews | |
| pids = webviews.map { |view| view.split(webview_prefix).last }.uniq |