Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void testFirmaanlegen() throws Exception {
- driver.get("http://xplorer.ibau.de/login");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa1");
- try { if (isElementPresent(By.xpath("(//input[@name='data[User][loginUsername]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[User][loginUsername]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[User][loginUsername]'])")).sendKeys("****");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa2");
- try { if (isElementPresent(By.xpath("(//input[@name='data[User][loginUserpassword]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[User][loginUserpassword]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[User][loginUserpassword]'])")).sendKeys("*****");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa3");
- try { if (isElementPresent(By.xpath("(//button[text()='Login'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//button[text()='Login'])")).click();
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa4");
- try { if (isElementPresent(By.xpath("(//button[text()='Eigene Infos'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- Thread.sleep(1000); //musste ich einbauen.
- try{
- driver.findElement(By.xpath("(//button[text()='Eigene Infos'])")).click();
- }
- catch(Exception e){
- if (checkForSession() == true){
- driver.findElement(By.xpath("(//button[text()='Eigene Infos'])")).click();
- }
- }
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa5");
- try { if (isElementPresent(By.xpath("(//span[text()='Eigene Firma anlegen'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//span[text()='Eigene Firma anlegen'])")).click();
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa6");
- try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchfield_name1'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_name1'])")).clear();
- driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_name1'])")).sendKeys("automated Test");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa7");
- try { if (isElementPresent(By.xpath("(//input[@id='owncontact_searchfield_lastname'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@id='owncontact_searchfield_lastname'])")).clear();
- driver.findElement(By.xpath("(//input[@id='owncontact_searchfield_lastname'])")).sendKeys("iBau");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa8");
- try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchfield_postcode'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_postcode'])")).clear();
- driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_postcode'])")).sendKeys("48163");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa9");
- try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchfield_town'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_town'])")).clear();
- driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_town'])")).sendKeys("Münster");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa10");
- try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchfield_street'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_street'])")).clear();
- driver.findElement(By.xpath("(//input[@id='owncompany_searchfield_street'])")).sendKeys("Teststreet");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa11");
- try { if (isElementPresent(By.xpath("(//input[@id='owncompany_searchtype_company'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@id='owncompany_searchtype_company'])")).click();
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa12");
- try { if (isElementPresent(By.xpath("(//button[text()='neue Firma anlegen'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//button[text()='neue Firma anlegen'])")).click();
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa13");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][title]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][title]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][title]'])")).sendKeys("Tester");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa14");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][firstname]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][firstname]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][firstname]'])")).sendKeys("This is an");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa15");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][name2]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][name2]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][name2]'])")).sendKeys("of ibau");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa16");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][pobox]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][pobox]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][pobox]'])")).sendKeys("501");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa17");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][pobox_postcode]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][pobox_postcode]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][pobox_postcode]'])")).sendKeys("48163");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa18");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][pobox_town]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][pobox_town]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][pobox_town]'])")).sendKeys("Münster");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa19");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][phone]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][phone]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][phone]'])")).sendKeys("02510251");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa20");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][mobilephone]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][mobilephone]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][mobilephone]'])")).sendKeys("01510151");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa21");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][fax]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][fax]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][fax]'])")).sendKeys("02510252");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa22");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][email]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][email]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][email]'])")).sendKeys("test@test.de");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa23");
- try { if (isElementPresent(By.xpath("(//input[@name='data[Company][website]'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//input[@name='data[Company][website]'])")).clear();
- driver.findElement(By.xpath("(//input[@name='data[Company][website]'])")).sendKeys("http://www.google.de");
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa24");
- try { if (isElementPresent(By.xpath("(//button[text()='Speichern'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//button[text()='Speichern'])")).click();
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa25");
- try { if (isElementPresent(By.xpath("(//h1[text()='This is an automated Test of ibau'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa26");
- try { if (isElementPresent(By.xpath("(//button[text()='Logout'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- driver.findElement(By.xpath("(//button[text()='Logout'])")).click();
- for (int second = 0;; second++) {
- if (second >= secondsToWait) System.out.println("timeoutfa27");
- try { if (isElementPresent(By.xpath("(//button[text()='Login'])"))) break; } catch (Exception e) {}
- Thread.sleep(1000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement