处理硒中的回发情况

时间:2017-05-11 04:41:53

标签: java selenium testing testng postback

你好,正在进行的项目有一个场景,如果用户没有从drop_down中选择选项并点击下一个按钮,则会给出错误消息。 现在我想检查显示的消息是否是预期消息......

 driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_btnSend']")).click();
  Thread.sleep(2000);
  String message=driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_divMsg']")).getText();
  Assert.assertEquals("Please select the event/activity you wish to claim points for", message);

正如我们在点击按钮上看到的那样,给出了以下消息

  

PASSED:登录   通过:claimpoints   失败:没有下降选择   org.openqa.selenium.WebDriverException:未知错误:元素...在点(507,598)处无法点击。其他元素会收到点击:...     (会话信息:chrome = 60.0.3088.4)     (驱动程序信息:chromedriver = 2.26.436362(5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform = Windows NT 10.0.10586 x86)(警告:服务器未提供任何堆栈跟踪信息)   命令持续时间或超时:111毫秒   构建信息:版本:'未知',修订版:'未知',时间:'未知'   系统信息:主持人:' AKHIL-PC',ip:' 192.168.1.38',os.name:' Windows 10',os.arch:&# 39; x86',os.version:' 10.0',java.version:' 1.8.0_131'   驱动程序信息:org.openqa.selenium.chrome.ChromeDriver   功能[{applicationCacheEnabled = false,rotate = false,mobileEmulationEnabled = false,networkConnectionEnabled = false,chrome = {chromedriverVersion = 2.26.436362(5476ec6bf7ccbada1734a0cdec7d570bb042aa30),userDataDir = C:\ Users \ Akhil \ AppData \ Local \ Temp \ scoped_dir13456_26342},takeHeapSnapshot = true,pageLoadStrategy = normal,databaseEnabled = false,handlesAlerts = true,hasTouchScreen = false,version = 60.0.3088.4,platform = XP,browserConnectionEnabled = false,nativeEvents = true,acceptSslCerts = true,locationContextEnabled = true,webStorageEnabled = true,browserName = chrome,takesScreenshot = true,javascriptEnabled = true,cssSelectorsEnabled = true,unexpectedAlertBehaviour =}]   会议ID:73b1cf7ec5d8ffd26f92aff6660b8f1a

0 个答案:

没有答案