Advertisement
Guest User

Untitled

a guest
Feb 17th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.32 KB | None | 0 0
  1. public void testFirmaanlegen() throws Exception {
  2. driver.get("http://xplorer.ibau.de/login");
  3.  
  4. for (int second = 0;; second++) {
  5. if (second >= secondsToWait) System.out.println("timeoutfa1");
  6. try { if (isElementPresent(By.xpath("(//input[@name='data[User][loginUsername]'])"))) break; } catch (Exception e) {}
  7. Thread.sleep(1000);
  8. }
  9.  
  10. driver.findElement(By.xpath("(//input[@name='data[User][loginUsername]'])")).clear();
  11. driver.findElement(By.xpath("(//input[@name='data[User][loginUsername]'])")).sendKeys("****");
  12.  
  13. for (int second = 0;; second++) {
  14. if (second >= secondsToWait) System.out.println("timeoutfa2");
  15. try { if (isElementPresent(By.xpath("(//input[@name='data[User][loginUserpassword]'])"))) break; } catch (Exception e) {}
  16. Thread.sleep(1000);
  17. }
  18.  
  19. driver.findElement(By.xpath("(//input[@name='data[User][loginUserpassword]'])")).clear();
  20. driver.findElement(By.xpath("(//input[@name='data[User][loginUserpassword]'])")).sendKeys("*****");
  21.  
  22. for (int second = 0;; second++) {
  23. if (second >= secondsToWait) System.out.println("timeoutfa3");
  24. try { if (isElementPresent(By.xpath("(//button[text()='Login'])"))) break; } catch (Exception e) {}
  25. Thread.sleep(1000);
  26. }
  27.  
  28. driver.findElement(By.xpath("(//button[text()='Login'])")).click();
  29.  
  30. for (int second = 0;; second++) {
  31. if (second >= secondsToWait) System.out.println("timeoutfa4");
  32. try { if (isElementPresent(By.xpath("(//button[text()='Eigene Infos'])"))) break; } catch (Exception e) {}
  33. Thread.sleep(1000);
  34. }
  35.  
  36. Thread.sleep(1000); //musste ich einbauen.
  37. try{
  38. driver.findElement(By.xpath("(//button[text()='Eigene Infos'])")).click();
  39. }
  40. catch(Exception e){
  41. if (checkForSession() == true){
  42. driver.findElement(By.xpath("(//button[text()='Eigene Infos'])")).click();
  43. }
  44. }
  45.  
  46. for (int second = 0;; second++) {
  47. if (second >= secondsToWait) System.out.println("timeoutfa5");
  48. try { if (isElementPresent(By.xpath("(//span[text()='Eigene Firma anlegen'])"))) break; } catch (Exception e) {}
  49. Thread.sleep(1000);
  50. }
  51.  
  52.  
  53. driver.findElement(By.xpath("(//span[text()='Eigene Firma anlegen'])")).click();
  54.  
  55. for (int second = 0;; second++) {
  56. if (second >= secondsToWait) System.out.println("timeoutfa6");
  57. try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchfield_name1'])"))) break; } catch (Exception e) {}
  58. Thread.sleep(1000);
  59. }
  60.  
  61. driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_name1'])")).clear();
  62. driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_name1'])")).sendKeys("automated Test");
  63.  
  64. for (int second = 0;; second++) {
  65. if (second >= secondsToWait) System.out.println("timeoutfa7");
  66. try { if (isElementPresent(By.xpath("(//input[@id='owncontact_searchfield_lastname'])"))) break; } catch (Exception e) {}
  67. Thread.sleep(1000);
  68. }
  69.  
  70. driver.findElement(By.xpath("(//input[@id='owncontact_searchfield_lastname'])")).clear();
  71. driver.findElement(By.xpath("(//input[@id='owncontact_searchfield_lastname'])")).sendKeys("iBau");
  72.  
  73. for (int second = 0;; second++) {
  74. if (second >= secondsToWait) System.out.println("timeoutfa8");
  75. try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchfield_postcode'])"))) break; } catch (Exception e) {}
  76. Thread.sleep(1000);
  77. }
  78.  
  79. driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_postcode'])")).clear();
  80. driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_postcode'])")).sendKeys("48163");
  81.  
  82. for (int second = 0;; second++) {
  83. if (second >= secondsToWait) System.out.println("timeoutfa9");
  84. try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchfield_town'])"))) break; } catch (Exception e) {}
  85. Thread.sleep(1000);
  86. }
  87.  
  88. driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_town'])")).clear();
  89. driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_town'])")).sendKeys("Münster");
  90.  
  91. for (int second = 0;; second++) {
  92. if (second >= secondsToWait) System.out.println("timeoutfa10");
  93. try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchfield_street'])"))) break; } catch (Exception e) {}
  94. Thread.sleep(1000);
  95. }
  96.  
  97. driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_street'])")).clear();
  98. driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_street'])")).sendKeys("Teststreet");
  99.  
  100. for (int second = 0;; second++) {
  101. if (second >= secondsToWait) System.out.println("timeoutfa11");
  102. try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchtype_company'])"))) break; } catch (Exception e) {}
  103. Thread.sleep(1000);
  104. }
  105.  
  106. driver.findElement(By.xpath("(//input[@id='owncompany_searchtype_company'])")).click();
  107.  
  108. for (int second = 0;; second++) {
  109. if (second >= secondsToWait) System.out.println("timeoutfa12");
  110. try { if (isElementPresent(By.xpath("(//button[text()='neue Firma anlegen'])"))) break; } catch (Exception e) {}
  111. Thread.sleep(1000);
  112. }
  113.  
  114. driver.findElement(By.xpath("(//button[text()='neue Firma anlegen'])")).click();
  115.  
  116. for (int second = 0;; second++) {
  117. if (second >= secondsToWait) System.out.println("timeoutfa13");
  118. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][title]'])"))) break; } catch (Exception e) {}
  119. Thread.sleep(1000);
  120. }
  121.  
  122. driver.findElement(By.xpath("(//input[@name='data[Company][title]'])")).clear();
  123. driver.findElement(By.xpath("(//input[@name='data[Company][title]'])")).sendKeys("Tester");
  124.  
  125. for (int second = 0;; second++) {
  126. if (second >= secondsToWait) System.out.println("timeoutfa14");
  127. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][firstname]'])"))) break; } catch (Exception e) {}
  128. Thread.sleep(1000);
  129. }
  130.  
  131. driver.findElement(By.xpath("(//input[@name='data[Company][firstname]'])")).clear();
  132. driver.findElement(By.xpath("(//input[@name='data[Company][firstname]'])")).sendKeys("This is an");
  133.  
  134. for (int second = 0;; second++) {
  135. if (second >= secondsToWait) System.out.println("timeoutfa15");
  136. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][name2]'])"))) break; } catch (Exception e) {}
  137. Thread.sleep(1000);
  138. }
  139.  
  140. driver.findElement(By.xpath("(//input[@name='data[Company][name2]'])")).clear();
  141. driver.findElement(By.xpath("(//input[@name='data[Company][name2]'])")).sendKeys("of ibau");
  142.  
  143. for (int second = 0;; second++) {
  144. if (second >= secondsToWait) System.out.println("timeoutfa16");
  145. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][pobox]'])"))) break; } catch (Exception e) {}
  146. Thread.sleep(1000);
  147. }
  148.  
  149. driver.findElement(By.xpath("(//input[@name='data[Company][pobox]'])")).clear();
  150. driver.findElement(By.xpath("(//input[@name='data[Company][pobox]'])")).sendKeys("501");
  151.  
  152. for (int second = 0;; second++) {
  153. if (second >= secondsToWait) System.out.println("timeoutfa17");
  154. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][pobox_postcode]'])"))) break; } catch (Exception e) {}
  155. Thread.sleep(1000);
  156. }
  157.  
  158. driver.findElement(By.xpath("(//input[@name='data[Company][pobox_postcode]'])")).clear();
  159. driver.findElement(By.xpath("(//input[@name='data[Company][pobox_postcode]'])")).sendKeys("48163");
  160.  
  161. for (int second = 0;; second++) {
  162. if (second >= secondsToWait) System.out.println("timeoutfa18");
  163. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][pobox_town]'])"))) break; } catch (Exception e) {}
  164. Thread.sleep(1000);
  165. }
  166.  
  167. driver.findElement(By.xpath("(//input[@name='data[Company][pobox_town]'])")).clear();
  168. driver.findElement(By.xpath("(//input[@name='data[Company][pobox_town]'])")).sendKeys("Münster");
  169.  
  170. for (int second = 0;; second++) {
  171. if (second >= secondsToWait) System.out.println("timeoutfa19");
  172. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][phone]'])"))) break; } catch (Exception e) {}
  173. Thread.sleep(1000);
  174. }
  175.  
  176. driver.findElement(By.xpath("(//input[@name='data[Company][phone]'])")).clear();
  177. driver.findElement(By.xpath("(//input[@name='data[Company][phone]'])")).sendKeys("02510251");
  178.  
  179. for (int second = 0;; second++) {
  180. if (second >= secondsToWait) System.out.println("timeoutfa20");
  181. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][mobilephone]'])"))) break; } catch (Exception e) {}
  182. Thread.sleep(1000);
  183. }
  184.  
  185. driver.findElement(By.xpath("(//input[@name='data[Company][mobilephone]'])")).clear();
  186. driver.findElement(By.xpath("(//input[@name='data[Company][mobilephone]'])")).sendKeys("01510151");
  187.  
  188. for (int second = 0;; second++) {
  189. if (second >= secondsToWait) System.out.println("timeoutfa21");
  190. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][fax]'])"))) break; } catch (Exception e) {}
  191. Thread.sleep(1000);
  192. }
  193.  
  194. driver.findElement(By.xpath("(//input[@name='data[Company][fax]'])")).clear();
  195. driver.findElement(By.xpath("(//input[@name='data[Company][fax]'])")).sendKeys("02510252");
  196.  
  197. for (int second = 0;; second++) {
  198. if (second >= secondsToWait) System.out.println("timeoutfa22");
  199. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][email]'])"))) break; } catch (Exception e) {}
  200. Thread.sleep(1000);
  201. }
  202.  
  203. driver.findElement(By.xpath("(//input[@name='data[Company][email]'])")).clear();
  204. driver.findElement(By.xpath("(//input[@name='data[Company][email]'])")).sendKeys("test@test.de");
  205.  
  206. for (int second = 0;; second++) {
  207. if (second >= secondsToWait) System.out.println("timeoutfa23");
  208. try { if (isElementPresent(By.xpath("(//input[@name='data[Company][website]'])"))) break; } catch (Exception e) {}
  209. Thread.sleep(1000);
  210. }
  211.  
  212. driver.findElement(By.xpath("(//input[@name='data[Company][website]'])")).clear();
  213. driver.findElement(By.xpath("(//input[@name='data[Company][website]'])")).sendKeys("http://www.google.de");
  214.  
  215. for (int second = 0;; second++) {
  216. if (second >= secondsToWait) System.out.println("timeoutfa24");
  217. try { if (isElementPresent(By.xpath("(//button[text()='Speichern'])"))) break; } catch (Exception e) {}
  218. Thread.sleep(1000);
  219. }
  220.  
  221. driver.findElement(By.xpath("(//button[text()='Speichern'])")).click();
  222.  
  223. for (int second = 0;; second++) {
  224. if (second >= secondsToWait) System.out.println("timeoutfa25");
  225. try { if (isElementPresent(By.xpath("(//h1[text()='This is an automated Test of ibau'])"))) break; } catch (Exception e) {}
  226. Thread.sleep(1000);
  227. }
  228.  
  229.  
  230. for (int second = 0;; second++) {
  231. if (second >= secondsToWait) System.out.println("timeoutfa26");
  232. try { if (isElementPresent(By.xpath("(//button[text()='Logout'])"))) break; } catch (Exception e) {}
  233. Thread.sleep(1000);
  234. }
  235.  
  236. driver.findElement(By.xpath("(//button[text()='Logout'])")).click();
  237.  
  238. for (int second = 0;; second++) {
  239. if (second >= secondsToWait) System.out.println("timeoutfa27");
  240. try { if (isElementPresent(By.xpath("(//button[text()='Login'])"))) break; } catch (Exception e) {}
  241. Thread.sleep(1000);
  242. }
  243. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement