SeleniumLibrary icon indicating copy to clipboard operation
SeleniumLibrary copied to clipboard

Get Table Cell low performance

Open mkorpela opened this issue 14 years ago • 4 comments

_TableElementKeywords._get_table_cell performance is very poor when finding out multiple cell values from the same table. A very basic result caching mechanism improved the situation on my clients test by 30%.

I'm willing to work on a patch to improve the situation on next week.

mkorpela avatar Nov 03 '12 18:11 mkorpela

Yes , I m also facing same problem so .. have you go any solution on this? I need it urgently solution on this for my project .. wanted to check sorted records from table.

Please Send me if you have solution on this - [email protected]

Gurud avatar Mar 20 '13 08:03 Gurud

Get Table Cell is particularly bad with Internet Explorer. Two ways to workaround the performance issue is to

  1. Reduce calls by working closely with WebDriver
  2. Use Execute JavaScript JavaScript is time-consuming and hard to write (especially in a cross-browser way), but it is definitely the fastest. I don't have an example because I have never gone that route. Here's an example showing how to use a Selenium2Library locator and get a collection of WebElements you can work with. Particularly, this logs the text of all the first cells in the keyword table. This is much faster than Get Table Cell, but is definitely ugly.
*** Settings ***
Library           Selenium2Library

*** Variables ***
${URL}            http://rtomac.github.com/robotframework-selenium2library/doc/Selenium2Library.html

*** Test Cases ***
Cell Test
    Open Browser    ${URL}    ie
    ${se2lib}=    Get Library Instance    Selenium2Library
    @{cells}=    BuiltIn.Call Method    ${se2lib._element_finder}    find    ${se2lib._current_browser()}    xpath=html/body/table[@class='keywords'][2]/tbody/tr/td[1]
    : FOR    ${webelement}    IN    @{cells}
    \    Log    ${webelement.text}

ombre42 avatar Mar 20 '13 18:03 ombre42

Thanks Kevin!

This is not browser specific issue. But I tried according to mentioned code for Xpath & made code with Get Text Keyword, it improves a lot & get solved issue.

Thanks a lot, Gaurav

On Wed, Mar 20, 2013 at 11:52 PM, Kevin Ormbrek [email protected]:

Get Table Cell is particularly bad with Internet Explorer. Two ways to workaround the performance issue is to

  1. Reduce calls by working closely with WebDriver
  2. Use Execute JavaScript JavaScript is time-consuming and hard to write (especially in a cross-browser way), but it is definitely the fastest. I don't have an example because I have never gone that route. Here's an example showing how to use a Selenium2Library locator and get a collection of WebElements you can work with. Particularly, this logs the text of all the first cells in the keyword table. This is much faster than Get Table Cell, but is definitely ugly.

*** Settings *** Library Selenium2Library

*** Variables *** ${URL} http://rtomac.github.com/robotframework-selenium2library/doc/Selenium2Library.html

*** Test Cases *** Cell Test Open Browser ${URL} ie ${se2lib}= Get Library Instance Selenium2Library @{cells}= BuiltIn.Call Method ${se2lib._element_finder} find ${se2lib._current_browser()} xpath=html/body/table[@class='keywords'][2]/tbody/tr/td[1] : FOR ${webelement} IN @{cells} \ Log ${webelement.text}

— Reply to this email directly or view it on GitHubhttps://github.com/rtomac/robotframework-selenium2library/issues/141#issuecomment-15194037 .

------------------------------ Warm Regards, GAURAV S. DEORE.

Gurud avatar Mar 24 '13 06:03 Gurud

There has not been activity for this issue for long time and we are planning to close the old issues if they are not anymore valid ones. If you feel that this is still valid issue, could you send an update. If update is not received in a month, we will assume that this is not anymore an issues and we will close this issue.

aaltat avatar Jun 08 '16 19:06 aaltat