我有如下畫面: 我使用下面的Ruby腳本點擊「新增」按鈕:不能點擊同一元素類使用的Watir
vendorTab = driver.a id: "tab-master-tab-vendor"
vendorTab.wait_until_present
if vendorTab.exists?
vendorTab.click
end
addNewButton = driver.button class: ['btn btn-primary']
addNewButton.wait_until_present
if addNewButton.exists?
addNewButton.click
end
但是,當我移動到另一個選項卡,並嘗試點擊相同的「添加新的」按鈕,Ruby腳本不起作用。 我的Ruby代碼有什麼問題嗎?
buildingTypeTab = driver.a id: "tab-master-tab-building"
buildingTypeTab.wait_until_present
if buildingTypeTab.exists?
buildingTypeTab.click
end
addNewButton = driver.button class: ['btn btn-primary']
addNewButton.wait_until_present
if addNewButton.exists?
addNewButton.click
end
我感謝您的幫助。非常感謝你。
感謝您的建議。我現在正在工作... – FMD