我已经尝试了card-paragraph-textbox.blue-highlight :parent .edit-Text
,但它无效:
例如:
card-paragraph-textbox.blue-highlight
孩子的班级名称: .edit-Text
。
父级的班级名称: :parent
。
关键字: let session = URLSession.shared
var request = URLRequest(url: URL(string:"https://api.mailgun.net/v3/sandboxXXX.mailgun.org/logs")!)
request.httpMethod = "POST"
let key = "api:key-XXX"
request.setValue("Basic \(toBase64(string: key))", forHTTPHeaderField: "Authorization")
let task = session.dataTask(with: request, completionHandler:{(data, response, error) in
if let err = error {
print(err)
}
if let response = response {
print("url = \(response.url!)")
print("response = \(response)")
let httpResponse = response as! HTTPURLResponse
print("response code = \(httpResponse.statusCode)")
}
})
task.resume()
请帮忙!!
答案 0 :(得分:1)
没有办法,请改用XPath。
获取父母:
//*[@class='edit-Text']
通过孩子获得父母:
//*[@class='card-paragraph-textbox blue-highlight']/..
或
//*[@class='card-paragraph-textbox blue-highlight']/parent::*