Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Appium、Ruby在RecyclerView中单击上下文_Ruby_Selenium_Appium - Fatal编程技术网

如何使用Appium、Ruby在RecyclerView中单击上下文

如何使用Appium、Ruby在RecyclerView中单击上下文,ruby,selenium,appium,Ruby,Selenium,Appium,如何使用Appium、Ruby在RecyclerView中单击元素。我尝试了各种方法,但无法单击 我已经尝试了所有可能的方法 require 'selenium-cucumber' require 'appium_lib' def alert1 $driver.find_element(xpath: "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/a

如何使用Appium、Ruby在RecyclerView中单击元素。我尝试了各种方法,但无法单击

我已经尝试了所有可能的方法

require 'selenium-cucumber'
require 'appium_lib'
def alert1
     $driver.find_element(xpath: "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button[2]") 
end
def alert2; $driver.find_element(xpath: "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button[2]") end
def phoneNumber; $driver.find_element(id: "com.accushield.familyapp:id/phone_number") end
def sendCode; $driver.find_element(id: "com.accushield.familyapp:id/send_code") end
def confirmationCode; $driver.find_element(id: "com.accushield.familyapp:id/confirmation_code") end
def submitCode; $driver.find_element(id: "com.accushield.familyapp:id/submit_confirmation_code") end
def dashboardScreen1; $driver.find_element(xpath: "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.support.v7.widget.RecyclerView/android.widget.FrameLayout[1]/android.view.ViewGroup").click end

Then(/^do user Login with OTP$/) do
    alert1.click
    alert2.click
    phoneNumber.send_keys("8131234567")
    sendCode.click
    confirmationCode.send_keys("123456")
    submitCode.click
    sleep 40

    #residentClick.click
    #$driver.find_element(xpath: "//android.widget.ImageView[@index='1']").click   
    dashboardScreen1.click
    #if dashboardScreen.displayed?
        #    puts "User has signed in successfully"
       # else
        #  puts "User sign in got failed"
        #  end
我需要单击“回收器”视图中的任何元素。请查找元素的图像