cloudflare
logger = logging.getLogger(__name__)
module-attribute
cf_find_interactive_challenge(tab)
async
Finds the Cloudflare interactive challenge elements.
This function scans the DOM for shadow roots and iframes that match the signature of a Cloudflare challenge.
Returns: A tuple containing the host element, the shadow root element, and the challenge iframe element if found, otherwise (None, None, None).
Source code in zendriver/core/cloudflare.py
cf_is_interactive_challenge_present(tab, timeout=5)
async
Checks if a Cloudflare interactive challenge is present and visible on the page.
Args: timeout: The maximum time in seconds to wait for the challenge.
Returns: True if the challenge is present and visible, False otherwise.
Source code in zendriver/core/cloudflare.py
cf_wait_for_interactive_challenge(tab, timeout=5)
async
Waits for the Cloudflare challenge iframe to appear and be visible.
Args: timeout: The maximum time in seconds to wait for the elements.
Returns: A tuple containing the host element, shadow root, and iframe element if found and visible, otherwise (None, None, None).
Source code in zendriver/core/cloudflare.py
verify_cf(tab, click_delay=5, timeout=15, challenge_selector=None, flash_corners=False)
async
Finds and solves the Cloudflare checkbox challenge.
The total time for finding and clicking is governed by timeout.
Args: click_delay: The delay in seconds between clicks. timeout: The total time in seconds to wait for the challenge and solve it. challenge_selector: An optional CSS selector for the challenge input element. flash_corners: If True, flash the corners of the challenge element.
Raises: TimeoutError: If the checkbox is not found or solved within the timeout.
Source code in zendriver/core/cloudflare.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |