| 242 | assert response.selector.re(class="st">"Some (.*)</title>") == [class="st">"page"] |
| 243 | |
| 244 | def test_selector_shortcuts(self): |
| 245 | body = bclass="st">"<html><head><title>Some page</title><body></body></html>" |
| 246 | response = self.response_class(class="st">"http://www.example.com", body=body) |
| 247 | |
| 248 | assert ( |
| 249 | response.xpath(class="st">"//title/text()").getall() |
| 250 | == response.selector.xpath(class="st">"//title/text()").getall() |
| 251 | ) |
| 252 | assert ( |
| 253 | response.css(class="st">"title::text").getall() |
| 254 | == response.selector.css(class="st">"title::text").getall() |
| 255 | ) |
| 256 | |
| 257 | def test_selector_shortcuts_kwargs(self): |
| 258 | body = b&class="cm">#x27;<html><head><title>Some page</title><body><p class=class="st">"content">A nice paragraph.</p></body></html>' |