我正在运行一个selenium脚本来为程序中的字段添加值,我的目标是找出 SAVE 无法如何有效地记录它;这样我就知道保存的过程失败了,如果抛出了异常;它与哪个元素/控制有关。
Chrome.FindElement(By.XPath(" // DIV [@id =' Spliter1_RightP_Content'] /表[@class =' ob_spl_panel'] / tbody的/ TR [1] / td / div [@class =' ob_spl_toppanel'] / div [@class =' ob_spl_toppanelcontent'] // div [@title ='添加新关系AA']"))点击();
//add record
Chrome.FindElement(By.XPath("//div[@id='Spliter1_RightP_Content']/table[@class='ob_spl_panel']/tbody/tr[3]/td/div[@class='ob_spl_bottompanel']/div[@class='ob_spl_bottompanelcontent']/div/div[4]/div[@class='ng-scope']/div[@class='ng-scope']//div[@class='row']/table[1]/tbody/tr[3]//input[@name='15986B36-838D-4F44-A7C7-04B2AFCA042F']")).SendKeys("MR");
Chrome.FindElement(By.XPath("//div[@id='Spliter1_RightP_Content']/table[@class='ob_spl_panel']/tbody/tr[3]/td/div[@class='ob_spl_bottompanel']/div[@class='ob_spl_bottompanelcontent']/div/div[4]/div[@class='ng-scope']/div[@class='ng-scope']//div[@class='row']/table[1]/tbody/tr[4]//input[@name='91D3E3C9-70C1-47B0-A125-FAAFBCA3C923']")).SendKeys("LOCAL ");
Chrome.FindElement(By.XPath("//div[@id='Spliter1_RightP_Content']/table[@class='ob_spl_panel']/tbody/tr[3]/td/div[@class='ob_spl_bottompanel']/div[@class='ob_spl_bottompanelcontent']/div/div[4]/div[@class='ng-scope']/div[@class='ng-scope']//div[@class='row']/table[1]/tbody/tr[5]/td[1]//input[@name='963F62CE-0C57-435C-AEA8-CE912CA0BFFC']")).SendKeys("DUDE ");
Chrome.FindElement(By.XPath("//div[@id='Spliter1_RightP_Content']/table[@class='ob_spl_panel']/tbody/tr[3]/td/div[@class='ob_spl_bottompanel']/div[@class='ob_spl_bottompanelcontent']/div/div[4]/div[@class='ng-scope']/div[@class='ng-scope']//div[@class='row']/table[1]/tbody/tr[3]//input[@name='C360F8E7-D427-4067-A1E9-34C8644CCD2C']")).SendKeys("PLAIN");
Chrome.FindElement(By.XPath(" //div[@id='Spliter1_RightP_Content']/table[@class='ob_spl_panel']/tbody/tr[3]/td/div[@class='ob_spl_bottompanel']/div[@class='ob_spl_bottompanelcontent']/div/div[4]/div[@class='ng-scope']/div[@class='ng-scope']//div[@class='row']/table[1]/tbody/tr[4]//input[@name='54EF9BEA-1AD3-4CCD-893C-291CEA82A561']")).SendKeys("SIMPLE");
Chrome.FindElement(By.XPath("//div[@id='Spliter1_RightP_Content']/table[@class='ob_spl_panel']/tbody/tr[3]/td/div[@class='ob_spl_bottompanel']/div[@class='ob_spl_bottompanelcontent']/div/div[4]/div[@class='ng-scope']/div[@class='ng-scope']//div[@class='row']/table[1]/tbody/tr[11]/td[3]//input[@name='3015E3A7-13BC-44FB-9844-A12B83F58D40']")).SendKeys("PLAIN@ymail.com");
Chrome.FindElement(By.XPath("//div[@id='Spliter1_RightP_Content']/table[@class='ob_spl_panel']/tbody/tr[3]/td/div[@class='ob_spl_bottompanel']/div[@class='ob_spl_bottompanelcontent']/div/div[4]/div[@class='ng-scope']/div[@class='ng-scope']//div[@class='row']/table[6]/tbody/tr[@class='H2Row']//table[@class='H2Table']//tr[@class='H2Row']/td[2]//input[@name='B3BF78C4-0833-466B-B8F3-85AFA812A4A2']")).SendKeys("jj@ymail.com");
//Drop down
Chrome.FindElement(By.CssSelector(".row > .H2Table:nth-child(2) .H2Row:nth-of-type(1) .H2ComboBox span")).Click();
//[ng-controller] .row > .H2Table:nth-child(2) .H2Row:nth-of-type(1) .chosen-single
Chrome.FindElement(By.CssSelector("[ng-controller] .H2Row:nth-of-type(9) .H2ComboBox span")).Click();
Chrome.FindElement(By.CssSelector("[ng-controller] .H2Row:nth-of-type(13) .H2ComboBox span")).Click();
// calendar
Chrome.FindElement(By.CssSelector("[ng-controller] .H2Table:nth-child(3) [src]")).SendKeys("GREGEG");
Chrome.FindElement(By.CssSelector("[ng-controller] .H2Table:nth-child(4) [src]")).Click();
//save record
Chrome.FindElement(By.XPath("//div[@id='H2ReactMainToolStripContainer']//div[@title='Save']/img[@src='App_Themes/H2React/Icons/Actions-document-save-icon.png']")).Click();
//pop up
new WebDriverWait(Chrome, TimeSpan.FromSeconds(5)).Until(ExpectedConditions.ElementToBeClickable(By.XPath("//body[@class='ng-scope']/div[@role='dialog']//div[@class='ui-dialog-buttonset']/button[1]/span[@class='ui-button-text']"))).Click();