Exemple #1
0
 def test_finds_nodes_by_the_given_css_selector(self):
     xpath = to_xpath(x.css("#preference p"))
     results = self.find_all(xpath)
     self.assertEqual(results[0].text, "allamas")
     self.assertEqual(results[1].text, "llama")
Exemple #2
0
 def _find_css(self, css):
     xpath = to_xpath(x.css(css))
     return self._find_xpath(xpath)
Exemple #3
0
 def test_is_composable(self):
     xpath = to_xpath(x.css("#moar").descendant("p"))
     results = self.find_all(xpath)
     self.assertEqual(results[0].text, "chimp")
     self.assertEqual(results[1].text, "flamingo")
 def _find_css(self, css):
     return self._find_xpath(to_xpath(x.css(css)))
Exemple #5
0
 def test_finds_nodes_by_the_given_css_selector(self):
     xpath = to_xpath(x.css("#preference p"))
     results = self.find_all(xpath)
     self.assertEqual(results[0].text, "allamas")
     self.assertEqual(results[1].text, "llama")
Exemple #6
0
 def test_is_composable(self):
     xpath = to_xpath(x.css("#moar").descendant("p"))
     results = self.find_all(xpath)
     self.assertEqual(results[0].text, "chimp")
     self.assertEqual(results[1].text, "flamingo")
Exemple #7
0
 def _find_css(self, css):
     elements = self.browser.dom.xpath(to_xpath(x.css(css)))
     return [Node(self, element) for element in elements]