"Undefined method `each' for :ole_object:Symbol - watir

Today i installed Ruby 1.9.2p180 (2011-02-18) [i386-mingw32] and i have the following problem. Was working fine with Ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]. I searched in many forums and still could not find a soultion. Please help!
I am getting the error Undefined method 'each' for :ole_object:Symbol (NoMethodError) when clicking a button using the code below.
ie.frame(:id,"body").table(:id,"recordListButton_UserList_ctl00")[1][2].click_no_wait
This was working fine in ruby 1.8.6
Error:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.4/lib/watir/locator.rb:11:in `normalize_specifiers!': undefined method `each'
for :ole_object:Symbol (NoMethodError)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.4/lib/watir/locator.rb:43:in `set_specifier'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.4/lib/watir/container.rb:109:in `tagged_element_locator'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.4/lib/watir/element.rb:36:in `locate'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.4/lib/watir/table.rb:249:in `locate'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.4/lib/watir/element.rb:75:in `assert_exists'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-2.0.4/lib/watir/table.rb:285:in `[]'
from //coldstorage/intranet/QA/Automation/Clickability for Blank DB- New Look and Feel/Admin Tab/Click_User_page_CC.rb:75:in `<main>'
>Exit code: 0
Note: when i try to do
ie.frame(:id,"body").table(:id,"recordListButton_UserList_ctl00").click_no_wait
in Watir 1.9.2 it is working. I don't understand why
table(:id,"recordListButton_UserList_ctl00")[1][2]
is causing the error. And the error is complaining about the method 'each' which i am not using anywhere in my script. Please help!
I have the following gems installed on my machine:
activesupport (2.3.9)
builder (3.0.0)
commonwatir (2.0.4, 2.0.3, 1.7.1, 1.6.7)
ffi (1.0.9 x86-mingw32)
firewatir (1.7.1, 1.6.7)
hoe (2.12.3)
minitest (1.6.0)
nokogiri (1.5.0 x86-mingw32)
rake (0.8.7)
rautomation (0.6.3)
rdoc (2.5.8)
s4t-utils (1.0.4)
user-choices (1.1.6.1)
watir (2.0.4)
win32-api (1.4.8 x86-mingw32)
win32-process (0.6.5)
windows-api (0.4.0)
windows-pr (1.2.1)
xml-simple (1.1.1)

The error I see above seems to indicate you upgraded not only Ruby, but Watir as well since I see 2.0.4 as part of the path to the the watir files.
One of the major changes between watir 1.x and watir 2.x is the move from one based to zero based indexing.
Have you revised the index values in your code, or added the following to the top of your scripts to use the old 1 based indexing?
require "watir"; Watir.options[:zero_based_indexing] = false
It might be that the error is a result of trying to send watir looking after an element that simply is not there.. e.g. the third cell on a row of a table with only two columns.
If the link you are clicking is the first one in the table, that might explain why just using .link (which is the same as .link(:index => 0) ) is working correctly, but trying to address the item by row and cell is not.

This sounds to me like ticket WTR-459 (click_no_wait does not work with frames). But, as far as I can see, that ticket is fixed.

Related

WxPython Error with wx.BufferedPaintDC method - Invalid DC

I'm currently updating a legacy application from Python 2.7.15 to Python 3.8.10. At the same time, I'm updating from wxPython version 2.8.12.1 to wxPython version 4.2.0.
I've used the 2to3 tool as well as done a lot of manual changes and the application is mostly running properly now. I have one major issue however, and it has to do with double-buffered drawing.
Specifically, in my onPaint() event handler, that has been bound to the EVT_PAINT event, I have the following code:
def onPaint(self,event):
drawPanelSize = self.drawPanel.GetSize()
self.bg_img = wx.Image('/background.png', wx.BITMAP_TYPE_ANY).Scale(drawPanelSize[0],
drawPanelSize[1])
bmp = wx.bitmap(self.bg_img)
dc = wx.BufferedPaintDC(self.drawPanel, bmp, wx.BUFFER_VIRTUAL_AREA)
There is more code above and below the code shown above, but this is the important area.
The problem that I am seeing is the following:
Traceback (most recent call last):
File "./TestBench.py", line 1553, in onPaint
dc = wx.BufferedPaintDC(self.drawPanel, bmp, wx.BUFFER_VIRTUAL_AREA)
wx._core.wxAssertionError: C++ assertion ""IsOk()"" failed at /tmp/pip-install-ewiqr929/wxPython/ext/wxWidgets/src/gtk/dc.cpp(238) in DoStretchBlit(): invalid DC
Does anyone have any insight into what may be going wrong here? Like I said this code worked fine using and older version of Python and an older version of wxPython. I would also accept any advice on how to appropriately debug this.
Please let me know if more information is required. I've already verified that the arguments to the function are valid. (i.e. self.drawPanel, and bmp are created properly and are valid arguments to the BufferedPaintDC method)
Also keep in mind most of the application (including the UI widgets, which are relying on gtk) is working at this point.
Things to note about my environment:
ubuntu (20:04)
gtk-3 (3.24.2)
Python (3.8.10)
wxPython (4.2.0)

Python - Search plugin of Folium doesn't appear

I'm trying to reproduce the following jupyter notebook :
https://nbviewer.jupyter.org/github/jtbaker/folium/blob/geojsonmarker/examples/plugin-Search.ipynb
But once I'm trying to create the map I had to make a few changes to the search plugin because of the documentation:
citysearch = Search(layer=citygeo,
geom_type='Point',
placeholder="Search for a US City",
collapsed=True,
search_label='nameascii'
).add_to(m)
becomes, according to the folium documentation here :
citysearch = Search(data=citygeo,
geom_type='Point',
search_label='nameascii'
).add_to(m)
The issue is that, at best the search plugin doesn't appear and at worse my folium map isn't displayed. Does anyone have this problem as well ? Or is there any dependecies I've forgot ?
Alright found the solution after couple days of research,
The example in the notebook is using a new search.pyfile which isn't updated in the folium document yet (as the working version is from december 23 2018 so it's very recent)
I just went to the pluginfolder to change the search.py with the github newest version Here Then it doesn't update automatically to my notebooks so I just created a new one and there it works !
OR simpler way : update folium to version 0.8.0 and it will work so just do pip install folium==0.8.0 (just went out yesterday)
I have the same problem as you. When you press F12 in your browser, you'll see that there's an JS-error. I tried replacing data=citygeo by data=citygeo.to_json() - which will display your map - but still doesn't show the searchbox.
My guess it has something to do with a bug in the latest new version of Folium. Hopefully it gets fixed soon.

New line characters in Cucumber Capybara

I'm using Cucumber with Capybara. I've noticed that suddenly, after a bundle install, that I'm getting failed tests now where new line characters are appearing in strings as part of the text.
Example error:
RSpec::Expectations::ExpectationNotMetError: expected to find text "Longview Road Clase Swansea SA6 7JL" in "Skip to main content\nGOV.UK\nDigital tachograph card\n......."
In the past, those new line characters weren't there. I'm struggling to track down which gem is causing this.
Is there a way to stop this without needing to do a strip on every string of text I extract from the webpage?
Some gem versions:
Capybara - 2.18
Rspec-expectations - 3.7.0
Cucumber - 2.4.0
Are you sure you're on Capybara 2.18? This is a behavior that changed in Capybara 3 where drivers are now expected to return text closer to what is displayed to the user - https://github.com/teamcapybara/capybara/blob/master/UPGRADING.md#node. If you really aren't using Capybara 3.x then you probably updated whatever driver you're using with Capybara and it is no longer supporting Capybara 2.x behavior.
If you are now on Capybara 3.x then you'll either need to change your tests to check for what is actually displayed (which is a more correct checking of things on the page) or you can use Capybara 3.5+ release which adds a normalize_ws option to the text/content matchers so you can write
expect(element).to have_text('Longview Road Clase Swansea SA6 7JL', normalize_ws: true)
to replicate more 2.x like behavior

Error Unknown variable:BouncingAtomsMorph openInWorld please correct or cancel

I'm new to Pharo ,my problem is when I try to run the BouncingAtomsMorph openInWorld example I keep getting the following error message:
Unknown variable:BouncingAtomsMorph openInWorld please correct or cancel
Please help!
Sadly Bouncing Atoms are no longer included in the standard distribution of newer Pharo versions.
To load it evaluate in a workspace or playground:
Gofer it
url: 'http://smalltalkhub.com/mc/PharoExtras/MorphExamplesAndDemos/main';
package: 'MorphExamplesAndDemos';
load.
Then
BouncingAtomsMorph new openInWorld
will work.
Pharo 5 update:
The MorphExamplesAndDemos package does no longer load correctly starting with Pharo 5. As described here, you can still look at the BouncingAtomsMorph by just clicking on Abandon when a debugger message tells you that this message is no longer understood (It's a problem with another example in the same package):
FileList class>>registerFileReader

Watir-webdriver issue with options.yml file

I have been using firewatir for quite some time but thinking of switching to watir-webdriver. I was playing with my existing script and getting an error in the IRB when i use watir-webdriver
Here is my code from existing script
require 'rubygems'
require 'watir-webdriver'
Watir.options_file = 'classes/options.yml'
I am getting a following error
"undefined method `options_file=' for Watir:Module (NoMethodError)"
Can someone point me to the right direction since I am lost on this for couple of days.
Thanks
Watir != Watir-Webdriver. Watir-Webdriver does not support options.yml using options_file, or most likely the options you're setting in it (browser.speed, etc).
You can find a list of available methods, as well as a comparison list of the two here: http://jarib.github.com/watir-webdriver/doc/ .
If you post the options you are setting in that file we can help you determine if they're available in Watir-Webdriver, or how else you use them.
Thanks
You can read more about watir-webdriver at http://watirwebdriver.com/

Resources