我无法在Form Request类中验证包含数组元素的字段。 规则方法:
public function rules()
{
return [
"state" => 'required',
"state.0" => 'required',
"state.*" => 'required',
];
}
请求中有一个数组 - > all()
"state" => array:1 [
0 => ""
]
零元素为空。但验证是成功的。 我做错了什么?
答案 0 :(得分:0)
为了处理动态字段,您需要遍历所有发布的parentTab = self.driver.find_element_by_class_name("capsuleList")
for selectAll in parentTab.find_elements_by_class_name("bsCapsule"):
cmpname = selectAll.find_element_by_css_selector(".Capsuletitle h2")
print(cmpname.text)
address = selectAll.find_element_by_css_selector(".Capsuleaddress a span")
print(address.text)
telephone = selectAll.find_element_by_css_selector(".Capsuletel")
print(telephone.text)
selectAll.find_element_by_css_selector('.Capsuletitle div a').click()
time.sleep(20)
adrurl = self.driver.find_element_by_css_selector('.CapsulecallToAction a').get_attribute('href')
print(adrurl)
self.driver.execute_script("window.history.go(-1)")
time.sleep(20)
并为每个>添加规则 STRONG>。
这是一个更新的方法,证明了这一点:
"items"