Questions tagged [ruby]

Ruby is a powerful and versatile programming language known for its multi-platform compatibility, open-source nature, and dynamic object-oriented features. The [ruby] tag is specifically designated for inquiries related to the Ruby language, encompassing aspects such as syntax and libraries. For queries specifically concerning the popular web application framework Ruby on Rails, it is advisable to utilize the [ruby-on-rails] tag.

Trouble with Ruby and Selenium: Struggling to identify visible elements in a list

Trying to figure out how to identify which elements in a list are visible has been quite the challenge for me. The application I'm working with features variable menu dropdowns where each row shows different options based on specific parameters, even thou ...

The ItemsController is throwing an error because it cannot find a constant for Item

Upon attempting to access the localhost:3000/items/new link, an uninitialized constant error in ItemsController::Item is encountered. The source of this issue is unclear at the moment. The structure of my Application.html.erb layout is as follows: <!D ...

Dynamic Variable Naming in Ruby

Currently, I am attempting to execute the following code snippet: @i, price_0, price_1, price_2 = 0, 0, 0, 0 until @i > 2 do if trade_history[@i]["type"] == 2 price_"#{@i}" = (trade_history[@i]["xbt_gbp"]).to_f ##NOT WORKING end ...

What is the process of updating the default version of Firefox using Selenium webdriver in Ruby?

I successfully changed the Firefox version I am using to 33.1 using this code. However, I want to make the current version the default without having to add extra code to each script. path='C:\Program Files (x86)\Mozilla Firefox\firefo ...

When using Ruby and Rack on Heroku to serve a static site, the CSS styling may not be

Trying to deploy a static site consisting of HTML, CSS, font, and image files with Ruby Rack has been a bit challenging. While the HTML displays perfectly in Chrome when running it locally, the CSS assets do not seem to be loading or being applied to the H ...

Executing Ruby Selenium Webdriver tests with Sauce Labs using a custom configuration to determine pass/fail

When working with Sauce Labs, there is a specific :passed option available for reporting the pass/fail status of a test - you can find more information about this at . I'm struggling to understand how to implement this feature in Ruby. One approach I've ...

While operating webdrive in headless mode, Firefox is still initializing

Trying to implement Selenium webdriver in headless mode but Firefox keeps opening up on my machine despite invoking it. Below is the code snippet I have been working with: @headless = Headless.new @headless.start @profile = Selenium::WebDriver: ...

Issue with rendering JavaScript in Rails 3 caused by AJAX

Seeking help with implementing an AJAX request in a Rails (3.0.3) view using link_to. <%= link_to "like", toggle_author_likes_path(current_author, post), :remote => true %> The plan is for the LikesController#toggle action to render Javascript t ...

Discover the methods for obtaining numerous JSON URLs and extracting dynamic information

I am currently in the process of developing my first application that extracts data from TMDB's API. Initially, I was successful in loading and parsing data from a single URL using the following code: uri = URI.parse("http://api.themoviedb.org/3/tv/#{URI ...

Tips for sending two objects simultaneously to a template through a Rails Ajax request

Looking to pass two objects to a template that will be rendered after an Ajax call using Rails 3. Take a look at my controller file below. controller/homes_controller.rb class HomesController < ApplicationController def home @sdf=TSdf.n ...

`How can you effectively navigate and engage with Shadow DOM elements using Watir?`

I am trying to access the page chrome://downloads/ to verify that a file has been downloaded, but it is using Shadow DOM. I came across an article on how to access DOM Elements With Selenium Webdriver. You can read it here. However, the code in the artic ...

Executing identical Cucumber Features on multiple machines simultaneously with parallel_tests gem

Running identical Cucumber Features simultaneously on various machines using the parallel_tests gem I am currently exploring how to utilize the parallel_tests gem in order to execute the EXACT SAME Cucumber Features concurrently on different machines. At ...

Serialization/deserialization of objects over HTTP using Ruby (without Rails)

I have encountered a similar question to this one before, but I am not satisfied with the answers provided as I am attempting to accomplish something more intricate. Within my web service, I am dealing with list/single objects such as Users, Categories, e ...

Using Ruby to convert JSON data into an array

This is an example of JSON code containing job and applicant information { "jobs": [ { "id": 1, "title": "Software Developer", "applicants": [ { "id": 1, "name": "Rich Hickey", "tags": ["clojure", "java", "immutability", "datom ...

Sending requests through RoR and receiving JSON responses - what's next?

Hey there! So I'm diving into the world of Ruby on Rails and I've managed to create a form that sends data to an external widget which then returns JSON. Here's what my form looks like: <%= form_for :email, :url => 'http://XXX.X ...

"422 (Unprocessable Entity) Error When Submitting a Form in Rails Application

I recently delved into the world of ruby on rails a few days back. My current challenge involves transferring data from html tags to a ruby function using ajax. Below is the error message that has been giving me trouble: POST http://localhost:3000/ajax/o ...

"Incompatibility between Ruby + watir-webdriver and Selenium Grid2 causes an exception

Using selenium-server-standalone-2.18.0.jar. Configured the hub and node on the same host. Executing the client code on a separate host. Observing in the hub console, I notice that one of the nodes has connected with 5 firefox icons. Upon running my clien ...

Modify only unprocessed text within the HTML content

Consider the following string: html_string = '<span><span class="ip"></span> Do not stare <span class="img"></span> at the monitor continuously </span> ' I am looking to modify the text within html_string by re ...

What is the best way to interact with the github avatar while forking with Selenium Webdriver?

I'm currently utilizing Selenium to navigate through the process of forking and cloning a repository. However, I'm encountering an issue where I am unable to click on the avatar to access my forked repository (refer to the image link provided). https://i. ...

Encountered a problem while attempting to set up puppeteer within a Docker container

I am currently facing an issue with a Docker container I have set up specifically for Ruby on Rails. This container is built from a Ruby docker container, and after successfully running bundle install and all other tasks, it encounters an error while tryin ...

Exploring the variations in test success across various browsers

When I try to click on elements using a CSS selector, such as: browser.find_element(:css, '.login').click I am noticing different behaviors in various browsers. Here is what I have observed: Chrome (version 35.0.1916.114) - works as intended Firefox (v ...

Unable to establish a secure connection with Firefox within a 60-second timeframe

Just starting out with Selenium Webdriver and trying to set up the basics. I'm using Windows 7, with Ruby 2.1.5, Selenium-WebDriver 2.45.0, and currently Firefox 33. (After encountering issues with Firefox 37, 36, and 35, I found a solution in a Stack Over ...

What is the process for transferring information from a Ruby controller to an application JavaScript using AJAX?

When clicking a button, an AJAX call is made in my application.js file. It sends 3 data points to the events_controller#check action: //application.js $(document).on('click', "#check-button", function(){ ... $.ajax({ ...

Whenever the browser page refreshes, ajax will_paginate inexplicably resets the page back to

I'm new to Ruby on Rails (RoR) and I have an application in which I am using Ajax with will_paginate, similar to what is shown in #174 Pagination with AJAX - RailsCasts. Everything is working fine, but I have encountered an issue where if I select a page u ...

Guide on implementing PHP.serialize for verifying a webhook in Ruby on Rails 5

Currently working with Ruby on Rails 5 and ruby -v 2.5.3, I'm in the process of verifying a webhook, following the instructions provided: require 'base64' require 'php_serialize' require 'openssl' public_key = '-----BEGIN PUBLIC KEY----- MIICIjANBgkqh. ...

Saving data to a database using knockout.js and JSON objects: A step-by-step guide

I have been assigned a task to work with knockout.js. In my project, I have a model called "employee" with fields such as name, country, and state. However, the issue I am facing is that I am unable to save any changes made during the editing process. Her ...

Whenever I try to execute watir-webdriver, I notice that the CSS file is

Currently, I am in the process of learning how to utilize watir-webdriver in ruby for my QA tasks. However, a recurring issue arises when running my watir-webdriver scripts on certain sites - some pages have missing CSS Files. This particular problem seems ...

Troubleshooting Rails 4: Handling a 404 Not Found Error When Making an AJAX Call to a

After spending about an hour trying to figure this out, I am still stuck... The action in my oferts_controller.rb file looks like this: def update_categories @categories = Category.children_of(Category.find(params[:categories])) respond_to ...

Initiate AJAX request when searching (utilizing the pg_search gem)

I've successfully implemented a search form using the pg_search gem, inspired by Railscast #343. Despite my efforts, the page always reloads on search queries. I attempted adding :remote => true to the form and utilized a respond_to block in the con ...

Decipher the communications sent by the server

I have been working on a hybrid application using vuejs and ruby on rails, and I am trying to figure out how to translate the error messages that are generated by the server. While I have managed to translate the titles easily with a method, I am strugglin ...

What is the best way to efficiently distribute shared page objects and cucumber step definitions across various Ruby projects?

I am working on several projects that require the use of shared step definitions and page objects in cucumber tests. Rather than duplicating these common elements in each project, I would like to find a way to share them across multiple projects. Has anyo ...

Implementing Ajax functionality in Ruby on Rails

I wish to send the selected drop-down menu value to a controller using ajax panel_controller.rb class PanelController < ApplicationController def insert @selected_city_ids = params[:city] end panel.js.erb $(document).ready(fun ...

The decision was made not to assess a string as JavaScript due to the use of 'unsafe-eval'

Hey there, I'm currently utilizing phantomjs for automation testing. Take a look at the code snippet below: capabilities = Selenium::WebDriver::Remote::Capabilities.phantomjs("phantomjs.page.settings.userAgent" => "Mozilla/5.0 (X11; Linux x86_64) ...

Control and manage AJAX POST requests in the controller

I'm currently working on implementing an ajax post request feature in my project. The goal is to have a button on my html page trigger a javascript event listener, which then initiates an ajax post request to receive some text data. However, I seem to ...

Utilizing Ruby interpolation to dynamically select elements in Capybara's CSS selectors

Having trouble with invalid selector errors when attempting to locate an element using capybara This method is successful: page.find("#widget_amount_Standard") But I encounter issues when trying any of the following: credit_type = "Standard" page.find( ...

The PHP equivalent of OpenSSL::HMAC.hexdigest will generate a different result compared to the Ruby implementation

I have a piece of ruby code that I'm trying to convert to PHP : print OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha1"), 'hello', Base64.encode64('bonjour')) The output : 62ac34e5d28563d6a50272d660805d1f8c791e41 This is my ...

I'm curious to know the Ruby equivalent of Selenium's elementToBeClickable compared to Java

As I delve into Ruby scripting for automation frameworks, I've been exploring the combination of Selenium and Ruby. One issue I've encountered is the absence of the elementToBeClickable method in Ruby Selenium. In a script where I attempt to click on an ...

Strategies for transmitting computed variables from a controller to JavaScript once the computation is complete?

Within my application, I have a button that triggers an action called "method" present in the UserController. This particular action involves executing some specific tasks. def method ***performing necessary calculations and operations*** @my_variable ...

Is there a continuous integration system available that supports Java, Python, and Ruby?

We have a range of technology tools at our disposal, including Java, Python, and Ruby code (and no, we're not Google ;-) ). Any recommendations for a good CI framework to use? Hudson or something else? dwh ...

Unpacking a container containing interconnected objects

Creating a command line two-player chess game has been an exciting challenge for me. I've structured it with a class for each type of chess piece and a main board class, which is outlined below: class Board attr_accessor :board, :choice def init ...

Pressing a "hyperlink"

I am facing an issue while trying to access a link that appears in a modal or hover. To begin with, I need to hover over the "Your Account" section (refer to the image below). I have scripted this action using the code snippet below: option = driver.find_ ...

Exploring Jenkins integration with Internet Explorer functionality

My current setup includes: selenium grid 2.53.0 hub and node for Internet Explorer; Jenkins; Internet Explorer 11. However, when attempting to execute a build for IE using a batch command with the variable BROWSER=ie, I encounter the following error: ...

Is this conversion from PHP to Ruby code accurate?

Currently, I am in the process of integrating an API for online payments. The API is designed using PHP code, but my website operates on Ruby on Rails. Therefore, I need to convert the PHP code to Ruby. Below is the PHP code snippet: $merchant_id = &apos ...

Connection to Firefox at 127.0.0.1:7055 on CentOS could not be established within the 60-second time frame

Encountering the following error message: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) when executing this code: require 'watir-webdriver' require 'headless' headless = Headless.new headless.start begin ...

Exploring the possibilities of using AngularJS for AJAX functionality in a Ruby On Rails

I recently started learning AngularJS and Rails, and I attempted to develop a Rails application incorporating AngularJS. Currently, I am looking to make a POST request to send data and insert it into the database. In the Activity Controller: def create ...

Transfer an image file to a Ruby on Rails server

I am having trouble sending JSON data with an image included. When I send the request without the image as a Bitmap, everything works fine. But when I include the image in the JSON, the server returns an error. This is how I am sending the request: R ...

Understand the nature of the reply

Can someone tell me the type of response an action controller will give before the instructions? respond_to do |format| format.html{ ... end Is it possible to determine this beforehand? Many thanks! ...

Processing and displaying JSON data along with nested attributes

Here are some of the classes I have: class Product attr_accessible :name, ... has_many :images end class Image attr_accessible :image, :position, :product_id, :title belongs_to :product In this case, I am trying to achieve the following action: def ...

Having trouble selecting a desired option from the drop-down menu by clicking on it

When using Selenium WebDriver, I am attempting to click on the Manual Testing option within the Testing menu on . The Manual Testing option is displayed after hovering the mouse over the Testing option. To achieve this functionality, I have implemented the ...

A guide on setting a default download location in Selenium

Is there a way to set a default download path in Selenium when using headless chrome in Docker? # docker-compose.yml services: chrome: container_name: chrome image: selenium/standalone-chrome-debug:3.9.1-actinium ports: - 4444:4444 Below ...

Incorporating JavaScript into a Rails Application

When I click on a link "link_to" in my rails app, I am attempting to trigger a JS file. To confirm that the asset pipeline is functioning correctly, I conducted a test with: $(document).ready(function() { alert("test"); }); The alert successfully po ...

Divergent behavior of Selenium xpath when used with python versus ruby

I'm currently facing an unusual problem with selenium. The following ruby code snippet: page.all(:xpath, "//table[3]//tr[last()]//td") Successfully retrieves all the cells of the last row from the third table on a webpage. In contrast, this python code ...

Tips for employing 'live CSS' in Rails

As someone who is new to Ruby on Rails, I am currently facing a challenge. I want to extract data from specific fields in my database and utilize them for styling purposes. For instance, within my 'Student' database, there are height and width f ...

Streamline transitions and optimize screen size with Selenium in Ruby

Recently joining a new company, I am now running my selenium tests using a Ruby framework. Working across three screens, I added a browser step to move the window to my leftmost screen before maximizing it: @driver.manage.window.move_to(-1800, 1500) @driv ...

404 error encountered when attempting to access the Swagger UI REST URL with the suffix (.json)

I launched a trial Grape REST API and now I'm attempting to test it using Swagger UI. The issue arises when Swagger UI loads the API specification by adding parentheses to the suffix: Unfortunately, this results in a 404 error because the (.json) suffix ...

Issue with creating source map - trouble with grunt and sass setup

Trying to set up SASS with Grunt and encountering some errors. Ruby, SASS, and Grunt are all installed in the path with the following versions: node: 0.10.20 npm: 1.3.11 grunt-cli: 0.1.13 grunt: 0.4.5 sass: 3.4.4 Package.json: ...

What is the process of including a pre-existing product as nested attributes in Rails invoices?

I've been researching nested attributes in Rails, and I came across a gem called cocoon that seems to meet my needs for distributing forms with nested attributes. It provides all the necessary implementation so far. However, I want to explore adding existi ...

Tips for keeping JavaScript created checkboxes saved and accessible

Utilizing the "ajax" function within the script enables communication with the server by sending post or delete messages. The javascript code that includes ajax is responsible for dynamically adding checkboxes to the page. How can we ensure that the create ...

Create a hash by converting arrays into a single array using Ruby mapping

In my programming project, I have an array called dates with 31 items (shown in a shortened form below) Tuesday 8, November Wednesday 9, November #etc. Also, there is a hash named movies with 31 entries, each containing movie names and showtimes (abbrevi ...

The link generated through ERB using link_to cannot be clicked on

When using the ERB link_to helper method to generate a hypertext link to an individual article, I am encountering an issue where the link appears as clickable in the view but is not actually clickable (the cursor does not change to a pointer). I have atte ...

Understanding how to open a PNG file in the client-side browser and transform it using PNGJS in React

Utilizing React JS for my application development is a current focus of mine. I have a solid understanding of how to import images within the client/browser folder structure. For example: import maze_text from '../../mazes/images/maze_text.png'; My aim ...

Access Chrome's console log using Ruby WebDriver

I came across a question that was previously answered for Java (Get chrome's console log) However, I am currently working with Ruby bindings and I'm curious if it offers similar functionality? I have checked the Ruby source code but couldn' ...

Generating links within a popover using an array in Rails 4

Within my application, Users have the ability to recommend other Users' profiles seamlessly. The functionality related to models and associations is working perfectly, as I am able to identify which users have recommended the current_user's profile by util ...

Ways to combine duplicate entries within a column using Ruby on Rails?

I need some help with a filtering issue related to sign names. I am trying to merge the content together if there is more than one name of the sign. You can refer to the image attached for better clarity, where I have two server names but I only want to di ...

Anyone faced the issue of jquery_ujs corrupting the callback URL in Rails 4, causing problems with updating screens via Ajax?

Encountering a Catch-22 situation with jQuery in my Rails app - when I include jquery_ujs, it pulls the wrong URL from Rails during execution, leading to quiet errors when attempting to access non-existent URLs on the server. However, if I omit jquery_ujs ...

Tips on effectively utilizing RABL partial templates while maintaining consistency

Currently working with Ruby on Rails 4 and incorporating the RABL gem into my project. I am seeking a way to reuse templates by rendering the show.json.rabl view from the index.json.rabl while following the standards outlined at jsonapi.org (source: RABL d ...

Guide on utilizing "selenium-webdriver-xpath" for extracting the text content from <td> tags?

Locate the following snippet of HTML code: <table id="supplier_list_data" cellspacing="1" cellpadding="0" class="data"> <tr class="rowLight"> <td class="extraWidthSmall"> <a href="/aems/do.list"> Cdata </a> ...

Executing a click action with Watir WebDriver that does not require waiting for the page to fully load

My webpage has a unique feature where one side refreshes when a button is clicked on the other side. I am curious to see if the site will malfunction if I click the buttons too quickly, not allowing enough time for the right side to fully load. Currently, ...

RAILS special characters JSON serialization and deserialization: a guide

I'm feeling a bit lost trying to figure out how to serialize and deserialize a simple line of code. I've searched for answers but nothing seems to address this specific issue. Can anyone help me with the following: JSON.parse("É".to_json) JSON: ...

How can we redirect to another page after checking a box?

In the scenario where a checkbox is checked, how can the page be automatically redirected to @habit, simulating the behavior of clicking a submit button? habits/show <% if @habit.current_level_strike %> <div class="btn" id="red"> <l ...

The error ElementNotVisibleError occurs in Selenium::WebDriver when attempting to use the send_key function with a Chrome browser, as the element is not currently visible

A problem has arisen with the Ruby Selenium script I am running in parallel. The issue occurs when attempting to send text input through send_key on a webpage while using the Chrome browser. Selenium::WebDriver::Error::ElementNotVisibleError: element not ...

Issue with jquery_ujs: Font Awesome spinning icon animation functions properly in Chrome but not in Safari

I've integrated font-awesome-rails into my Rails project. When a user clicks the submit button on a form: The submit button should display an animated font-awesome spinner and change text to "Submitting...". The button must be disabled to prevent m ...

Displaying a pop-up message in Rails upon modifying a Model

Would it be feasible to implement the ActiveRecord Callbacks before_create after_create before_save after_save before_destroy after_destroy in order to showcase notifications to the user using jQuery? Could someone possibly share an example?? Appreci ...

What is the method for embedding a concealed form within a table?

I am a beginner in HTML and RoR. I am trying to include a button inside a table that will submit a hidden form. However, I am facing an issue where the button is not showing up in the generated HTML. <table class="centerBox"> <h3>Search Resu ...

Tips for conducting Performance Testing using Selenium

I have been trying out new things lately, specifically focusing on selenium for the past 4 months. Can selenium be used for performance testing? If so, how can it be done? I would appreciate any information provided. ...