Forum Discussion

lydincamilleri's avatar
lydincamilleri
Occasional Contributor
3 years ago

Mobile - Swipe to an element

Hello!

I am trying to find a way how I can scroll in an application until an element is visible.

 

Basically the original issue is that using app.FindElementByXpath of an object errors with "Unable to find an element that matches the specified 'xpath' selector strategy", however, it works when I manually scroll onto the object.

 

On web, I am aware of the ScrollIntoView functionality, but can't find anything similar for android/ios?

 

Thanks in advance!

3 Replies

  • So what is happening here is google chrome is crashing during the run.

     

    Chrome uses /dev/shm for runtime data which is 64MB by default under Docker. If this is not sufficient then this can cause Chrome to crash . Possible workarounds:

    • Increase the size of /dev/shm
    • Mount /dev/shm to the host's
    • Start Chrome with the flag --disable-dev-shm-usage
    •  
  • Hi,

     

    You're gitlab-ci.yml looks good

     

    Can you provide more logs of your pipeline?

    Do you properly run chrome in headless mode?

     

            WebDriverManager.chromedriver().setup();
    
            ChromeOptions options = new ChromeOptions();
            options.setHeadless(true);
    
            driver = new ChromeDriver(options);
    

     

    • rezza's avatar
      rezza
      Occasional Contributor

      aurelien-reeves 
      Hi

      Thanks for replying.

      What is needed to providing?

      May I give all the pipeline's output?

      This is my file which has the driver configurations.

      And This is that file after adding the chromeDriver headLess option.

      As you can see, I added the chromeDriver headLess option.

       

      Before adding, everything is worked in IDE mode.

      But when I add the chromeDriver headLess option, I face this error in the testNG's report:


      feature (Login into account)
      cucumber.runtime.CucumberException: java.lang.AssertionError: Unable to wait and click on the WebElement, using locator: <Proxy element for: DefaultElementLocator 'By.linkText: Sign in'>
      	at cucumber.api.testng.TestNGCucumberRunner.runCucumber(TestNGCucumberRunner.java:69)
      	at cucumber.api.testng.AbstractTestNGCucumberTests.feature(AbstractTestNGCucumberTests.java:21)
      Caused by: java.lang.AssertionError: Unable to wait and click on the WebElement, using locator: <Proxy element for: DefaultElementLocator 'By.linkText: Sign in'>
      	at org.junit.Assert.fail(Assert.java:89)
      	at pageObjects.BasePage.waitAndClickElement(BasePage.java:59)
      	at pageObjects.Login_page.clickOnSignInButton(Login_page.java:35)
      	at stepDefinitions.LoginSteps.user_clicks_on_the_login_button_on_homepage(LoginSteps.java:18)
      	at ✽.And User clicks on the login button on homepage(Login.feature:6)
      ... Removed 28 stack frames
      (Runs Cucumber Feature)

       

      I didn't run the test in GitLab mode. because first, I want to solve the problem in IDE mode.

      I'm so new, please guide me.

      Thanks in advanced.

      • For better readability, could you paste your code in the forum using the "insert code sample" snippet instead of JustPaste.it?

         

        And I suggest you run your tests not in headless mode in your IDE. Maybe something is actually failing but as it is in Headless mode, you can not see it.

         

        Can you remove the code about Firefox and IE to make it cleaner and easier to debug?