Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    vkutepov
    @vkutepov
    tittle : wrong number of arguments (given 1, expected 0)
    what is this title?
    i use rspec and capybara
    vkutepov
    @vkutepov
    I pass the parameters for the test through each (data provider) maybe because of this an error?
    Thomas Walpole
    @twalpole
    what line of code is that coming from?
    vkutepov
    @vkutepov
    capybara/node/document.rb: line 31
    vkutepov
    @vkutepov
    this error is due to the allure-rspec gem. When I delete this code there is no error:
    config.include AllureRspec :: Adapter
    Thomas Walpole
    @twalpole
    I mean what line of code in your project
    simon foucher
    @simonfoucher
    Hello, having some issues using Capybara to fill in some Credit Card fields for Stripe's new 3DSecure flow - can anyone help? Thanks in advance!
    Thomas Walpole
    @twalpole
    What exactly are the issues you’re having?
    simon foucher
    @simonfoucher
    I want to fill in the CC field so I tried with:
    find(:xpath, '//div[contains(@class, "StripeElement ")]').send_keys("4000002760003184") but that gives me an error: unknown error: cannot focus element
    or with:
    fill_in('Card details', :with => "4000002760003184") this method always skips the first character, never enters a '4'.
    Thanks for your help!
    Thomas Walpole
    @twalpole
    Try clicking the element first
    find(:field, ‘Card Details’).click.fill_in(with: ‘....’)
    Thomas Walpole
    @twalpole
    It's possible the first keystroke is actually triggering the input widget to change state or something - which clicking before may trigger
    also - you're generally going to better off preferring CSS over xpath when CSS can handle things so your first try would have been find('div.StripeElement').send_keys(...) - wouldn't change whether or not it works but will be slightly faster, easier to read, and you don't have to worry about // vs .// scoping trap that you do when using XPath
    Thomas Walpole
    @twalpole
    Use the webdrivers gem to lock the correct version of geckodriver and then configure selenium in your driver registration to point at whichever Firefox version you want it to use
    simon foucher
    @simonfoucher
    @twalpole thank you for your response, looking into it today. Pretty awesome you are available to answer our questions, much appreciated.
    simon foucher
    @simonfoucher
    @twalpole so i'm still having issues, using find(:field, ‘Card Details’).click.fill_in(with: ‘....’) fails: unknown error: Element ... so I tried with find('div.StripeElement').click.fill_in(with: card_number) but that still skips the first character... There are so many different ways to do this I get a little lost in the methods. Thanks in advance
    Uwe Kubosch
    @donv
    Hi all! I am trying to find the screen size of the emulated device when using add_emulation('Pixel 2'). current_window.size does not give the right size. Is there a way to get the emulated device screen size?
    Thomas Walpole
    @twalpole
    @donv current_window.size gives the size of the window as returned by the driver. This is generally the actual size of the window. When using emulation the actual size and the emulated size doesn't always match so you'll probably need to use JS via evaluate_script to get the window size.
    Uwe Kubosch
    @donv
    @twalpole OK, thanks.
    AbhijayGhadyale
    @AbhijayGhadyale
    can anyone help me for capybara code to upload multiple files in one go for angular website <input id="vh-attachment-file-0" type="file" multiple="multiple" style="display: none"> and code I used is
    find(:css, input_id, :visible => false).set(filepath)
    Thomas Walpole
    @twalpole
    You need to pass an array of file names to upload multiple - and visible: false will only work in very limited cases. What error are you getting?
    Thomas Walpole
    @twalpole
    @AbhijayGhadyale also, if using a recent version of Capybara (if not, why not) then rather than find(…).set(…) you should be using attach_file with an action block - see https://rubydocs.org/d/capybara-3-30-0/classes/Capybara/Node/Actions.html#method-i-attach_file
    AbhijayGhadyale
    @AbhijayGhadyale
    @twalpole attach_file code is not working, I tried multiple times
    AbhijayGhadyale
    @AbhijayGhadyale
    @twalpole I defined array as
    files = [
    "/O2Cylinder.png",
    "/H2Cylinder.png",
    ] and capybara code as files.each do |item|
    input = find(:css, input_id ,:visible => false)
    input.set(File.expand_path(File.dirname(File.basename(Dir.getwd)))+item)
    end it is working but problem is only getting uploaded last file H2Cylinder.png not both ( I am new to ruby and capybara please guide me if making any mistakes)
    Thomas Walpole
    @twalpole
    @AbhijayGhadyale Without seeing the attach_file code you used (and the exact errors) it’s impossible to say why it doesn’t work - it definitely should and would be a much better replication of what a user would do (assuming you’re testing and not just scraping)
    As to the multiple files, don’t do files.each — just pass the Array of file names to set (or attach_file)
    again though - calling set on elements found with visible: false will only work on some browsers and may break with any release - it is not recommended
    Thomas Walpole
    @twalpole
    attach_file(files) do # files should be an array of absolute path names
       find(…).click # click on whatever element a user would click on to trigger opening of the file selection dialog
    end
    AbhijayGhadyale
    @AbhijayGhadyale
    when I click on element where window opens to select files , my code stops
    Thomas Walpole
    @twalpole
    What do you mean by “my code stops” ? If you’ve done attach_file with a block like I show on a recent version of Capybara the file select dialog shouldn’t actually open
    Capybara tracks that click to detect which file input to add the files to, and prevents the file select dialog from actually opening
    Thomas Walpole
    @twalpole
    @AbhijayGhadyale What version of Capybara are you using? Which browser are you using? and what code are you using?
    AbhijayGhadyale
    @AbhijayGhadyale
    Working on Angular website with dynamic file upload component and version of capybara (3.29.0)
    and chrome browser Version 79.0.3945.88 (Official Build) (64-bit)
    Thomas Walpole
    @twalpole
    @AbhijayGhadyale if the example I showed doesn’t work for you then show the exact code you’re using and the full error you’re getting
    AbhijayGhadyale
    @AbhijayGhadyale
    Hi I am getting find('#element').hover getting error getelementregion , is any one know about this?
    It is the element I want to hover and then click
    AbhijayGhadyale
    @AbhijayGhadyale
    but getting error getelementregion
    failed to parse value of getElementRegion
    Thomas Walpole
    @twalpole
    @AbhijayGhadyale Show the actual code you're using and give details of what driver, and versions of things you're using - a quick grep shows that getElementRegion isn't called anywhere in Capybara or Selenium.
    Also - post the exact error you're getting
    marc graff
    @mgraffx
    I am looking for a place to ask a siteprism question. Suggestions?
    Thomas Walpole
    @twalpole
    @mgraffx Stackoverflow possibly - depending on the type of question
    marc graff
    @mgraffx
    @twalpole , thanks. will try there
    simon foucher
    @simonfoucher
    hello! i cant seem to use send_keys() with a field that uses suggested values. I can use fill_in() to input some characters but I need to hit :enter to actually select a value - any way i can do this? using capybara/ruby with chrome webdriver.
    Thomas Walpole
    @twalpole
    What does the HTML look like, and what exactly have you tried
    simon foucher
    @simonfoucher
    I actually just got it to work by adding a newline character as such :
    specific_dept_field_css = ".Select-control"
    specific_dept_field = find(:css, specific_dept_field_css)
    specific_dept_field.click.fill_in(with: department+"\n")
    HTML: (looks terrible but i guess I can't upload a screenshot here)
    <div class="Select-control" xpath="1"><span class="Select-multi-value-wrapper" id="react-select-21--value"><div class="Select-placeholder"></div><div class="Select-input" style="display: inline-block;"><input aria-activedescendant="react-select-21--value" aria-expanded="false" aria-haspopup="false" aria-owns="react-select-21--backspace-remove-message" role="combobox" value="" style="box-sizing: content-box; width: 5px;"><div style="position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; overflow: scroll; white-space: pre; font-size: 14px; font-family: walsheim, &quot;Century Gothic&quot;, CenturyGothic, sans-serif; font-weight: 300; font-style: normal; letter-spacing: normal; text-transform: none;"></div></div></span></div>