コード例 #1
0
 def test_dom_capture_speed(self):
     # now = dt.datetime.now()
     # cur_date = now.strftime("%Y-%m-%d")  # 2018-10-14
     # month_ahead = (now + dt.timedelta(days=30)).strftime("%Y-%m-%d")  # 2018-11-14
     start = time.time()
     dom_json = dom_capture.get_full_window_dom(self.driver)  # noqa: F841
     end = time.time()
     print("TOOK {} ms".format((end - start) * 1000))
コード例 #2
0
    def test_send_dom_nsa(self):
        expected_json = self._get_expected_json("test_send_dom_nsa")
        dom_json = dom_capture.get_full_window_dom(self.driver,
                                                   return_as_dict=True)
        assert dom_json["css"] == expected_json["css"]

        def inner_css(o):
            return o["childNodes"][1]["childNodes"][3]["childNodes"][0]["css"]

        assert inner_css(dom_json) == inner_css(expected_json)
コード例 #3
0
 def test_send_dom_bestbuy1(self):
     try:
         self.driver.find_elements_by_css_selector(
             ".us-link")[0].element.click()
     except IndexError:
         # click isn't required
         pass
     start = time.time()
     dom_json = dom_capture.get_full_window_dom(self.driver)  # noqa: F841
     end = time.time()
     print("TOOK {} ms".format((end - start) * 1000))
コード例 #4
0
    def test_send_dom_simple_HTML(self):
        actual_dom_json = dom_capture.get_full_window_dom(self.driver,
                                                          return_as_dict=True)
        expected_dom_json = self._get_expected_json(
            "test_send_dom_simple_HTML")

        assert actual_dom_json["tagName"] == expected_dom_json["tagName"]
        assert actual_dom_json.keys() == expected_dom_json.keys()
        assert sorted(actual_dom_json["rect"].keys()) == sorted(
            expected_dom_json["rect"].keys())
        assert actual_dom_json["style"] == expected_dom_json["style"]
        assert len(actual_dom_json["childNodes"]) == len(
            expected_dom_json["childNodes"])
        assert (actual_dom_json["childNodes"][0]["tagName"] ==
                expected_dom_json["childNodes"][0]["tagName"])
        assert (actual_dom_json["childNodes"][-1]["tagName"] ==
                expected_dom_json["childNodes"][-1]["tagName"])
コード例 #5
0
 def test_send_dom_booking2(self):
     dom_json = dom_capture.get_full_window_dom(self.driver)  # noqa: F841
コード例 #6
0
 def test_send_dom2(self):
     expected_json = self._get_expected_json("test_send_dom2")
     dom_json = dom_capture.get_full_window_dom(self.driver,
                                                return_as_dict=True)
     assert dom_json["css"] == expected_json["css"]