I am trying to retrieve, modify, and reinsert some text in a pop up dialog using watir web-driver. All was going swimmingly until I tried to find a way to click the “Save Book Info” button pictured here: https://i.stack.imgur.com/pGdln.png
However I am unable to find the button. To access the pop up box I gather all the links with the correct name into an array:
@browser.imgs.each do |img| #The links are imgs
if img.title.include?('Edit/Delete Book')
@books << img
end
end
From there I can access the links with @books[index].click. I am able to access and edit the text_fields with:
url = @browser.text_field(:name=>'url').value
... do stuff with url ..
@browser.text_field(:name=>'url').set url
But when I try and find the “Close” button I only get the buttons that are on the main page. After many headaches I managed to find the title of the window I want to work with using @browser.div(:class=>'dijitDialogTitleBar').title, which returns "Edit Book". Success! No. I still can’t figure out how to access the buttons on that popup!
If anyone could help me with this I would be most grateful. This is my first time using Watir so it’s probably a simple answer…
If more information is needed I’d be happy to supply it. Thanks in advance.
EDIT
Here is the html for the button:
<span id="dijit_form_Button_2_label"
class="dijitReset dijitInline dijitButtonText"
dojoattachpoint="containerNode">Save Book Info</span>
It looks like you have a span tag that is styled to be looked like a button. You need to access it is a span instead of a button.
Try: