The method `col_span` is not defined for the `Watir::TableCell` class, resulting in a NameError

Recently, I decided to explore automation testing and gave the following code a try.

My attempt to launch the Firefox browser using the code snippet below:

@browser = Watir::Browser.new :firefox
@browser.goto "https://www.linkedin.com/"

When(/^I enter username as (.*?)$/) do |username|
  @browser.element(:xpath => "//[@id='login-email']").set username
end
....
.... and so on

Unfortunately, I encountered an error message when running the first line to load the browser.

undefined method col_span' for classWatir::TableCell' (NameError)

The technologies used in my setup include Ruby (2.5), Cucumber(1.3.2), Watir(4.0.2), and Selenium-webdriver(2.53.4).

Any guidance or assistance on this issue would be greatly appreciated. Thank you!

Answer №1

Starting from Watir version 6.7, attribute methods have been simplified to just the lowercase attribute name without using snake case.

For example, instead of using colspan, you would now use:

browser.td.colspan

Answer №2

If you're interested in using Watir, consider installing just the watir gem instead of watir-webdrive. Afterwards, make sure to require watir in your code. When referring to the class, remember to use Watir with a capital "W". Here's an example of how I successfully called chromedriver.exe:

require 'watir'
browser = Watir::Browser.new

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Determining the presence of a navigation bar with Webdriver

Upon reviewing the image below, my focus was on verifying two key elements: 1. The navigation bar is correctly displayed on the page with accurate dimensions. 2. The labels "Home", "About Us" etc. are accurately shown on the navigation bar and function a ...

What is the method to ensure an element is displayed in Selenium WebDriver?

Looking for assistance on how to choose options from a dropdown when the element is not visible and has a boolean attribute? Here's the HTML code snippet: <select id="visualizationId" style="width: 120px; display: none;" name="visualization"> & ...

Guide on extracting the text from the <script> tag using python

I'm attempting to extract the script element content from a generic website using Selenium. <script>...</script> . url = 'https://unminify.com/' browser.get(url) elements = browser.find_elements_by_xpath('/html/body/script[ ...

I am attempting to retrieve an OTP from a MySQL database and send it as a password. The challenge now is figuring out how to use Java Selenium WebDriver to send

enter code here: public static void main(String[] args) throws ClassNotFoundException, SQLException, InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\\Users\\admin\\Documents\\selenium ...

The following code is experiencing difficulties when running on the Chrome browser

https://i.stack.imgur.com/GjG7r.pngI have developed a function that can click the checkbox of a specific row and retrieve the text from that row. CheckBoxXpath-> private static final String XPATH_JOBRATECATEGORIES_CHECKBOX_LIST = "//kendo-grid-list// ...

Selenium IDE - ways to save the URL of a hyperlink and navigate to it later? Was previously functioning as expected

A few months ago, everything was working perfectly with my test. However, now it fails and I'm unsure why or how to resolve the issue. Background: On a screen, there are various links that allow the logged-in 'admin' user to log in as one ...

Scraping data using Selenium with paragraph tags

I've been scouring the internet for examples similar to the one in question, but with no luck. The challenge at hand revolves around extracting text from a webpage where only one of two p tags contains important information. How can data be extracted ...

Determine the relationship between two elements using Xpath within a table on a website

I am currently working with Selenium and Python, so please keep that in mind when providing an answer. My current challenge is to verify that the number indicated by the "green arrow" matches the one shown by the "red arrow". These numbers are generated r ...

Details about the Chrome driver can be found in the console

While running my selenium tests with ChromeDriver, I am seeing this message in the console: Starting ChromeDriver 2.15.322448 (521791b310fec1797c81ea9a20326839860b7d3) on port 15823 Is there a method to hide or prevent this message from appearing in the ...

Attempting to select an input field

I'm having trouble clicking on the Select Files button that is nested within a SPAN and Input Tag. Despite using Xpath, Id, and Name, I am unable to successfully click on the button. <span> Select <u>a</u> Files... </span> & ...

Guide to using Python Selenium to locate and click on the last text found on a webpage

When visiting a webpage, I noticed that there are multiple texts with the same name. For example: Explore Explore Explore Explore Explore I am interested in clicking either the 4th or 5th occurrence of this text. Please note that the count of occurren ...

use selenium to choose an element

I'm attempting to target a specific element in the HTML code below: <ul class="selectReplace opened"> <li class="default">Standard pizzas</li> <li class="first">Standard pizzas</li> <li class="">Special pizzas</ ...

Using iedriverserver.exe to manage Edge in IE Mode with VBA scripting

Are there any code examples available for controlling Edge in IE Mode using iedriverserver.exe in VBA? I have the exe downloaded but am having trouble adding the necessary library to tools->reference in my VBA project. If anyone has experience with this t ...

Having trouble retrieving the value from the XML file when the key is passed as a parameter

Latest QAF Version 2.1.13 along with 2.1.14-RC1 The XML file contains the following test data - <registration> <existingdata> <title>Mr</title> <firstname>Narendra</firstname> <lastnam ...

Utilizing Selenium JavaScript to insert a cookie into a request

Trying to add a cookie to the request in Selenium using JavaScript. I followed the documentation at this link, but my code snippet doesn't seem to pass any cookies to the PHP script below on the server. Here is the client-side JavaScript code: var w ...

Struggling to find a specific element on a website with Xpath in Selenium using Python

Attempting to retrieve data from a website named: , specifically targeting the element: /html/body/div[1]/div/main/div/div[2]/div/div[2]/div/div/div[1]/div[4]/div[2]/div[1]/div[1]/div[2]/span[2] which displays volume as a number on the webpage. The code I ...

The string cannot be validated using the equalsIgnoreCase method, resulting in a false return value

https://i.stack.imgur.com/ZDab4.png expectedResult= Forecast sourceVal = PDPE actual value is Enforcement Type Forecast PDPE When using equalsIgnoreCase, it fails because the string cannot be matched. Any suggestions on how to effectively validate the va ...

Transitioning from using nose to pytest in Selenium testing

Considering transitioning from our current testing framework nose with a nose-testconfig to py.test. Seeking suggestions on how to replace the setup and teardown in the code snippet below using pytest fixtures. class BaseTestCase(unittest.TestCase, Naviga ...

Having trouble running Selenium Chrome Driver on Pi Zero with error code -4?

Having trouble setting up a script on my new Pi Zero W after it was previously working on my Pi 3 B. It seems like the hardware may be the culprit as simply transferring the entire operating system to the new pi results in this issue, with no other changes ...

Problems with Selenium RC, Nunit, and Firefox causing browser crashes when clicking

In the process of testing a sophisticated web application, we are utilizing a test framework that consists of C#, Nunit 2.5.10 and Selenium RC 2.24.1 (Unfortunately, switching to WebDriver is not currently an option). After revamping our application' ...