Hi PerlMonks, I am automating a sharepoint page to add certain testcases in the pre-existing list.I am importing the data from an excel file and trying to add it to sharepoint textfileds. For most of the field I am fine, but there 1 field that has taken my sleep away.It is a richtext field. my code is as follows
#!/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.goo +gle.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.as +px", 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.p +andey\@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/sp +an[1]","","ribbon titled item clicked"); sleep(5); $sel->click_ok("//*[\@id='Ribbon.ListItem.New.NewListI +tem-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-b86 +3-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_87a5c +789-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_2549932 +9-daed-4ae4-b963-7ed8dc142ec3_\$TextField_label']", "$Expected_Result +", "Expected Location added for $j");### this line of code is not wor +king 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; # } }
The line of code that is not working for me is $sel->type_ok("//*[\@id='Expected_x0020_Result_25499329-daed-4ae4-b963-7ed8dc142ec3_\$TextField_label']", "$Expected_Result", "Expected Location added for $j"); This particular field has following x-paths
<div class="ms-rtestate-field ms-rtefield ms-inputBox ms-inputBoxActiv +e" id="Expected_x0020_Result_25499329-daed-4ae4-b963-7ed8dc142ec3_$Te +xtField_topDiv"><div id="Expected_x0020_Result_25499329-daed-4ae4-b96 +3-7ed8dc142ec3_$TextField_inplacerte_label" style="display:none">Rich + text editor Expected Result</div><div rtedirty="false" aria-multilin +e="true" aria-haspopup="true" aria-autocomplete="both" role="textbox" + class="ms-rtestate-write ms-rteflags-0 ms-rtestate-field" id="Expect +ed_x0020_Result_25499329-daed-4ae4-b963-7ed8dc142ec3_$TextField_inpla +certe" style="min-height:84px" aria-labelledby="Expected_x0020_Result +_25499329-daed-4ae4-b963-7ed8dc142ec3_$TextField_inplacerte_label" co +ntenteditable="true"><p></p><span rtenodeid="2" id="ms-rterangecursor +-start"></span><span id="ms-rterangecursor-end"></span><br></div><div + style="clear : both;"></div></div> <div rtedirty="false" aria-multiline="true" aria-haspopup="true" aria- +autocomplete="both" role="textbox" class="ms-rtestate-write ms-rtefla +gs-0 ms-rtestate-field" id="Expected_x0020_Result_25499329-daed-4ae4- +b963-7ed8dc142ec3_$TextField_inplacerte" style="min-height:84px" aria +-labelledby="Expected_x0020_Result_25499329-daed-4ae4-b963-7ed8dc142e +c3_$TextField_inplacerte_label" contenteditable="true"><p></p><span r +tenodeid="2" id="ms-rterangecursor-start"></span><span id="ms-rterang +ecursor-end"></span><br></div>
In reply to Entering text into richtext field by rahul.xeqtr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |