(node: html.HtmlElement, bid: str)
| 175 | return True |
| 176 | |
| 177 | def is_visible(node: html.HtmlElement, bid: str) -> bool: |
| 178 | if self.dataset == 'mind2web': |
| 179 | bound = node.attrib.get('bounding_box_rect', None) |
| 180 | self.rect[bid] = rect2tuple(bound) |
| 181 | |
| 182 | if not self.use_position: |
| 183 | return True |
| 184 | |
| 185 | rect = self.rect.get(bid, None) |
| 186 | if rect is None: |
| 187 | return False |
| 188 | |
| 189 | if self.window_size is None: |
| 190 | return True |
| 191 | |
| 192 | # get window size |
| 193 | wx, wy, ww, wh = self.window_size |
| 194 | x, y, w, h = rect |
| 195 | if x + w < wx or x > wx + ww or y + h < wy or y > wy + wh: |
| 196 | return False |
| 197 | |
| 198 | return True |
| 199 | |
| 200 | def _dfs(node: html.HtmlElement, keep: list[str]=[], obs: list[str]=[], |
| 201 | parent_chain: bool=False, get_new_label: bool=False, par_keep: bool=False) -> (str, dict[str]): |
nothing calls this directly
no test coverage detected