Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Selenium Send Keys Giving Warning about size

I'm uploading content through python selenium binding element.send_keys(content), but I get a content size error.

My data will grow bigger.

Can you please give me a solution through which I can append the selected element in chunks rather than putting the complete and entire data to my selected field where I want to enter data?

I mean I want to put data to the selected element in chunks rather than putting it in in a single action.

By getting this kind of error, seems not good for my system and python as well.

But I'm not sure about it. Just want to know is it true?

Please give me the proper idea how can I send data through send_keys in chunks. It's very much necessary and needy to get its solution.

Thanks for your help.

[1560:9968:1211/012355:ERROR:latency_info.cc(157)] RenderWidgetHostImpl::OnSwapC
ompositorFrame, LatencyInfo vector size 161 is too big.
[1560:9968:1211/012357:ERROR:latency_info.cc(157)] RenderWidgetHostImpl::OnSwapC
ompositorFrame, LatencyInfo vector size 419 is too big.
[1560:9968:1211/012402:ERROR:latency_info.cc(157)] RenderWidgetHostImpl::OnSwapC
ompositorFrame, LatencyInfo vector size 640 is too big.
[1560:9968:1211/012422:ERROR:latency_info.cc(157)] RenderWidgetHostImpl::OnSwapC
ompositorFrame, LatencyInfo vector size 169 is too big.
[1560:9968:1211/012424:ERROR:latency_info.cc(157)] RenderWidgetHostImpl::OnSwapC
ompositorFrame, LatencyInfo vector size 448 is too big.
[1560:9968:1211/012428:ERROR:latency_info.cc(157)] RenderWidgetHostImpl::OnSwapC
ompositorFrame, LatencyInfo vector size 557 is too big.
like image 402
Umar Asghar Avatar asked Dec 10 '15 20:12

Umar Asghar


People also ask

Why sendKeys is not working in Selenium?

sendKeys() not working in Selenium WebdriverJavaScript command to be used is passed as a parameter to this method. To input text we shall first identify the edit field with the JavaScript method document. getElementsByClassName. Then apply the value method on it.

What is send keys in Selenium Python?

What Is SendKeys? SendKeys is a method used to send keyboard input such as characters, numbers, and symbols to text boxes inside an application. When you are testing an application, all the actions are taken care of by the WebDriver element, which sendKeys is a part of.

How do you press a key in Selenium Python?

Selenium's Python Module is built to perform automated testing with Python. Special Keys is an exclusive feature of Selenium in python, that allows pressing keys through keyboard such as ctrl+f, or shift+c+v, etc. class selenium.

How do you send a key in Python?

send_keys() is a process in which keyboard inputs such as numbers, texts, and symbols are sent to the text boxes of an application. send_keys() is a part of WebDriver, and each keyboard input is sent to this element.


2 Answers

I know I'm late to the question but I recently had this problem. I managed to work around the issue by chucking the string I'm using for SendKeys into 128 chunks and sending them instead of the whole string.

I was working in C# but I'm sure you could port this code or if anyone else has a similar issue.

This is the chunking code

static IEnumerable<string> ChunksUpto(string str, int maxChunkSize) {
    for (int i = 0; i < str.Length; i += maxChunkSize) 
        yield return str.Substring(i, Math.Min(maxChunkSize, str.Length-i));
}

Taken from Splitting a string into chunks of a certain size

like image 169
Richard Adnams Avatar answered Oct 17 '22 07:10

Richard Adnams


@ulf-gjerdingen asked for answer in python for the same, I think it is answered in:

How do you split a list into evenly sized chunks?

The answer that I have choosen is using boltons.iterutils, install boltons with pip and then:

from boltons import iterutils
somelong_str = 'veeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrytttttttttttttttt loooooooooooong stringggggggggggggggggggggggggggggggggggggg to ensurrrrrreeeeeeeeeeeeeeeeeeeeeeeeee it will be chuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuncked'
iterutils.chunked(somelong_str, 128)

It will return a list of strings in this case.

To get more help from python console:

help(iterutils.chunked) 
like image 25
Pablo Daniel Estigarribia Davy Avatar answered Oct 17 '22 07:10

Pablo Daniel Estigarribia Davy