Guest User

Untitled

a guest
Jun 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. print("Hi!. Script Started")
  2. # code to load webpage, automatically fill whatever can be entered
  3. x = input("Waiting for manual date to be entered. Enter YES when done.")
  4. # Enter the data on page manually. Then come back to terminal and type YES and then press enter.
  5. if x == 'YES':
  6. continue_script_here()
  7. else:
  8. kill_script_or_something_else()
  9.  
  10. WebDriverWait wait = new WebDriverWait(driver, 100);
  11. //whatever time you think is sufficient for manually entering the data.
  12. WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id(>someid>)));
  13. if(ExpectedConditions.attributeToBeNotEmpty(element,"value"))
  14. {
  15. //continue with the automation flow
  16. }
  17.  
  18. driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
  19. driver.switchTo().defaultContent();
  20.  
  21. for(int i =1;i>0;i++)
  22. {
  23. ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles());
  24. if(tabs.size()==2)
  25. {
  26. //keep checking for the point when the number of tabs becomes 1 again.
  27. continue;
  28. }
  29. else
  30. {
  31. break;
  32. }
  33. }
  34. //your rest of the automation code
Add Comment
Please, Sign In to add comment