#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::WWW::Selenium; use Spreadsheet::ParseExcel; my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse("Additional test cases.xls"); if ( !defined $workbook ) { print "i am in if"; die $parser->error(), ".\n"; } # Parameters are passed through to WWW::Selenium my $sel = Test::WWW::Selenium->new( host => "localhost", port => 4444, browser => "*chrome", browser_url => "http://www.google.com", default_names => 1, error_callback => sub { ... }, ); # use special test wrappers around WWW::Selenium commands: $sel->open_ok("https://afsi.sharepoint.com/Answers/IT/Application%20Support/Lists/75%20Kendospecific%20Regression%20testing/AllItems.aspx", undef, "fetched sharepoint's site alright"); $sel->window_maximize(); $sel->type_ok("cred_userid_inputtext","rahul.pandey\@afsi.com"); $sel->wait_for_page_to_load_ok(500000000); sleep(5); $sel->type_ok("ctl00_ContentPlaceHolder1_UsernameTextBox","rahul.pandey\@afsi.com"); $sel->type("ctl00_ContentPlaceHolder1_PasswordTextBox","f4TLxCQT"); sleep(5); $sel->click("ctl00_ContentPlaceHolder1_SubmitButton"); $sel->wait_for_page_to_load_ok(500000000); sleep(10); my $j=4030; for my $worksheet ( $workbook->worksheets() ) { #for ($i=3;$i++;$i<148) { $sel->click_ok("//*[\@id='Ribbon.ListItem-title']/a/span[1]","","ribbon titled item clicked"); sleep(5); $sel->click_ok("//*[\@id='Ribbon.ListItem.New.NewListItem-Large']/a[1]/span/span/img","","ribbon titled new item clicked"); $sel->wait_for_page_to_load_ok(500000000); sleep(10); my $cell = $worksheet->get_cell( 1,2); my $test_Status=$cell->value(); $cell = $worksheet->get_cell( 1,3); my $test_location=$cell->value(); $cell = $worksheet->get_cell( 1,4); my $sub_test_location=$cell->value(); $cell = $worksheet->get_cell( 1,5); my $Test=$cell->value(); $cell = $worksheet->get_cell( 1,6); my $Expected_Result = $cell->value(); #$sel->type_ok("//*[\@id='Title_fa564e0f-0c70-4ab9-b863-0177e6ddd247_\$TextField']", "$test_Status", "test status added for $j"); #$sel->type_ok("//*[\@id='Issue_x0020_ID_a1517b7b-f6f5-48c1-a445-319c3c86aa3b_\$NumberField']", "$j", "test id added for $j"); #$sel->type_ok("//*[\@id='Test_x0020_Location_80797698-d44a-4f1c-b78a-9067d196e97c_\$TextField']", "$test_location", "test location added for $j"); #$sel->type_ok("//*[\@id='SubTest_x0020_Location_87a5c789-0ad7-4974-93e9-6787c1f0c4be_\$TextField']", "$sub_test_location", "sub test location added for $j"); #$sel->type_ok("//*[\@id='Test_af9f0da2-5c9c-46a7-9b09-7bcf92800f59_\$TextField']", "$Test", "TEST added for $j"); $sel->type_ok("//*[\@id='Expected_x0020_Result_25499329-daed-4ae4-b963-7ed8dc142ec3_\$TextField_label']", "$Expected_Result", "Expected Location added for $j");### this line of code is not working for me sleep(15); #$sel->click_ok("//*[\@id='Ribbon.ListForm.Edit.Commit.Publish-Large']/span[1]/span/img","","Test Case $j added"); $j=$j+1; # } } ####