Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to increase the sb.type() insertion speed when dealing with big HTML text #3961

Answered by mdmintz
Khald1998 asked this question in Q&A
Discussion options

Problem Description

When using sb.type("textarea.c-jOMmSw", prompt) from SeleniumBase, inserting large HTML text (like prompt2 in the code below) is significantly slower compared to shorter texts (like prompt1). The delay occurs specifically when the prompt contains lengthy HTML content, despite the function working instantly for smaller inputs. This impacts automation efficiency when dealing with large data inputs.

Code Example

from seleniumbase import SB
def generate_response(prompt):
 with SB(uc=True) as sb:
 sb.open("https://build.nvidia.com/deepseek-ai/deepseek-r1-0528")
 # Slow with large HTML text (prompt2), fast with short text (prompt1)
 sb.type("textarea.c-jOMmSw", prompt) # Delay occurs here for big HTML
 # ... additional logic for handling responses
prompt1 = "Your question here" # Fast insertion
prompt2 = "```<div><p>...</p></div>```" # Large HTML content - slow insertion

Expected vs Actual Behavior

  • Expected: sb.type() should insert text quickly regardless of content size.
  • Actual:
    • Short text (e.g., prompt1): Instant insertion.
    • Large HTML text (e.g., prompt2): Takes significantly longer to complete.

Environment

  • SeleniumBase Version: latest version.
  • OS: Linux and Windows (issue on both)

Question

Are there way to accelerate sb.type() for large content?

You must be logged in to vote

You could try sb.cdp.set_value(selector, text) if sb.cdp.type(selector, text) isn't fast enough for you. Keep in mind that UC Mode / CDP Mode is about bypassing bot-detection, not about going as quickly as possible (which makes you look like a bot).

Replies: 1 comment

Comment options

You could try sb.cdp.set_value(selector, text) if sb.cdp.type(selector, text) isn't fast enough for you. Keep in mind that UC Mode / CDP Mode is about bypassing bot-detection, not about going as quickly as possible (which makes you look like a bot).

You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /