diff --git a/docs/topics/selectors.rst b/docs/topics/selectors.rst index 688c2b715..273cae0f8 100644 --- a/docs/topics/selectors.rst +++ b/docs/topics/selectors.rst @@ -146,12 +146,12 @@ If you want to extract only first matched element, you can call the selector ``. It returns ``None`` if no element was found: - >>> response.xpath('//div/[id="not-exists"]/text()').extract_first() is None + >>> response.xpath('//div[@id="not-exists"]/text()').extract_first() is None True A default return value can be provided as an argument, to be used instead of ``None``: - >>> sel.xpath('//div/[id="not-exists"]/text()').extract_first(default='not-found') + >>> sel.xpath('//div[@id="not-exists"]/text()').extract_first(default='not-found') 'not-found' Notice that CSS selectors can select text or attribute nodes using CSS3