是否可以捕获Ajax调用响应并验证它是否是Selenium中的有效消息或错误?

时间:2019-06-14 15:23:25

标签: json

Ajax响应包含JSON,我需要验证此Json。

尝试使用等待方法,但不了解如何捕获硒中的JSON数据

样本Ajax响应: {“ ondemand_mos_test”:{“ ondemand_mos_test_id”:1414,“ location_id”:487,“ voip_network_assesment_test_id”:null,“ status”:2,“ type”:“ adhoc”,“ created_at”:“ 2019-06-14 15: 00:42“,” updated_at“:” 2019-06-14 15:01:43“,” location“:{” location_id“:487,” customer_id“:161,” address_id“:1267,” shipping_address_id“:1268 ,“名称”:“无薪现金通道”,“ api_key”:“ d42b14e068a1df530095569ab4bc00d8”,“状态间隔”:5,“ mos_score”:“ 4.0”,“纬度”:46.3642,“经度”:-72.5094,“ utc_offset”:“” -4“,” status_last_captured“:” 2019-06-14 15:01:43“,” activation_date“:” 2019-06-06“,” monitoring_mode_id“:2,” is_purchased“:1,” is_active“:1 ,“ is_deleted”:0,“ created_at”:“ 2019-06-06 11:51:44”,“ updated_at”:“ 2019-06-14 15:01:43”,“ att_location_id”:null,“激活码” :6620168,“购买日期”:“ 2019-06-06”,“ device_tz”:“ EST5EDT,M3.2.0,M11.1.0”,“时区”:“美国/蒙特利尔”,“ hpbx_provider_id”:15,“ ext_subscription_id” :“ 1366554000001170134”,“ is_fulfilled”:0,“ ext_salesorder_id”:“ 1366554000001172031”,“ ext_invoice_id”:“ 1366554000001170150”,“ is_acl_entry _created“:0}},” ondemand_mos_test_status“:2,” mos_score“:” 4.34“,” jitter“:” 0.19“,” latency“:” 118.21“,” packet_loss“:” 0.00“,” rfactor“:” 90.24“,” mos_score_r“:” 4.35“,” jitter_r“:” 0.00“,” packet_loss_r“:” 0.00“,” rfactor_r“:” 90.25“,” latency_r“:” 117.83“,” mosScore_r“:1,” mosScore“:1,” location_name“:” Payless Cashways“,” date“:” 06/14/2019“,” time“:” 11:01:43“,” ondemand_mos_test_id“:1414,” result“:” 1 “}

我必须检查JSON是否包含上述消息或错误。

0 个答案:

没有答案