selenium2library

How to reduce waiting time in Selenium2Library Robot Framework

爷,独闯天下 提交于 2019-12-04 13:40:56
I have a test script in Robot Framework which I want to reduce its elapsed time. I have below command as a part of the test procedure: wait until element is enabled id=${elementId} In run time, it takes about 5 seconds to be done; I've set selenium implicit wait to 2 seconds using below line at the beginning of the test: set selenium implicit wait 2 seconds I get the applied selenium implicit wait afterwards with get selenium implicit wait and it returns 2 seconds , but the first command still takes about 5 seconds to complete. What should I do to reduce this time?? Any help or suggestion will

Accessing elements located by custom locator strategy with Javascript

限于喜欢 提交于 2019-12-02 17:09:29
问题 I have following issue: I have a checkbox which is hidden and there is another layer used to make it nice and shiny I can easily change its value by accessing its ID however I also need to access this element using my custom locator which uses xpath (that has to stay variable) So, here's my script: Custom Select Checkbox id=my_checkbox #that works fine Custom Select Checkbox customLocatorStrat #that doesn't work at all *** Keywords *** Custom Select Checkbox [Arguments] ${locator} ${timeout}=

Accessing elements located by custom locator strategy with Javascript

心已入冬 提交于 2019-12-02 10:12:39
I have following issue: I have a checkbox which is hidden and there is another layer used to make it nice and shiny I can easily change its value by accessing its ID however I also need to access this element using my custom locator which uses xpath (that has to stay variable) So, here's my script: Custom Select Checkbox id=my_checkbox #that works fine Custom Select Checkbox customLocatorStrat #that doesn't work at all *** Keywords *** Custom Select Checkbox [Arguments] ${locator} ${timeout}=${global_timeout} Execute Javascript document.getElementById("${resultLocator}").checked = true; OR $

How to run headless REMOTE chrome using robot framework

瘦欲@ 提交于 2019-11-30 03:48:27
I'm trying to run chrome headless with my robot framework tests suites. I managed to do it independtly with python using selenium as follows: options = webdriver.ChromeOptions() options.add_argument('--headless') my_driver = webdriver.Remote(command_executer=my_remote_address, desired_capabilities=options.to_capabilities) The following code is what I did in robot but didn't work: ${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver ${options.add_argument}= Set Variable add_argument=--headless Create WebDriver Chrome chrome_options=${options} Open

Centralizing XPath in resource file, how to pass arguement from robot file?

≯℡__Kan透↙ 提交于 2019-11-29 16:40:48
I am centralizing all particular XPath strings to a resource file and importing the variables in that resource file in my test suite (robot framework). This way, they can be maintained in one place and I can use variable names that make the robot file readable. Is that something that is good practice? Sometimes I want to pass an argument to the variable, to make it more dynamic. However, the value of the variable contains and XPath, which sometimes has //div[path...etc][text()='MyString']. Question: In the robot file, how to pass an argument ('MyString') to the Click Element method that is

How to use variable, which value should be set in keyword or test, in XPATH?

爱⌒轻易说出口 提交于 2019-11-29 07:44:51
I need to click on element based on what value it contains..but I want to set this value in test run or keyword definition (best option is in the test I guess) How should I do it? the variable containing xpath should look like that: ${DROPDOWN ITEMS} xpath=//*[contains(@class,'listitem-element')]/span[contains(text(),'${second_number}')] This locator works when I replace the variable with actual number like '002', but I want to have it more general.. In keyword definition I use it like: Choose Value From Dropdown focus ${DROPDOWN ITEMS} click element ${DROPDOWN ITEMS} and in test I just call

wait until the page is loaded

大城市里の小女人 提交于 2019-11-28 05:45:58
问题 In Robot Framework, does any keyword in any library implement this? Open Browser and Go To just go to the requested URL but don't wait until the page document is fully loaded. 回答1: Have a look at this discussion. You don't really need to wait for anything apart from Ajax. In case you are using Angular, have a look at extendedselenium2library that implements waiting for Angular actions with every keyword. If you are not using Angular, but you know which Ajax action you expect will fire before