samedi 3 février 2018

WebDriver click() on Google Forms for the second time on same submit button

I need to click on the button to get onto second page of Google Forms and here are my steps.

  1. Submit form (to find out that one answer is mandatory)
  2. Fill the mandatory question
  3. Submit again (with the same button) to get onto the second page

Submit button works but the problem is when I try to submit it for the second time. I see the animation the button was clicked but nothing happens. Any idea how to make it work please?

// STEP 2 Validate that third question is mandatory
    driver.findElement(By.cssSelector("span.quantumWizButtonPaperbuttonLabel.exportLabel")).click();
    String errorTextActual = driver.findElement(By.xpath("//*[@id=\"i.err.1133270322\"]")).getText();
    assertEquals(errorTextExpected, errorTextActual);

// STEP 3 Fill third question and go to another step
    driver.findElement(By.xpath("/html/body/div/div[2]/form/div/div[2]/div[2]/div[3]/div[2]/div/div[1]/div/div[1]/input")).sendKeys(thisMonth);
    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
    driver.findElement(By.cssSelector("span.quantumWizButtonPaperbuttonLabel.exportLabel")).submit();

SUBMIT button

<div role="button" class="quantumWizButtonPaperbuttonEl quantumWizButtonPaperbuttonFlat quantumWizButtonPaperbutton2El2 freebirdFormviewerViewNavigationNoSubmitButton isUndragged" jscontroller="VXdfxd" jsaction="click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;" jsshadow="" jsname="OCpkoe" aria-disabled="false" tabindex="0"><div class="quantumWizButtonPaperbuttonRipple exportInk" jsname="ksKsZd"></div><div class="quantumWizButtonPaperbuttonFocusOverlay exportOverlay"></div><content class="quantumWizButtonPaperbuttonContent"><span class="quantumWizButtonPaperbuttonLabel exportLabel">Další</span></content></div>

Aucun commentaire:

Enregistrer un commentaire