![](/img/trans.png)
[英]Selenium web driver getting the text from the for attribute of a label using Ruby
[英]how to click on text area to send long text using ruby with selenium web driver
我試過xpath和id直到“ unil”:10秒后超時(沒有這樣的元素(Selenium :: WebDriver :: Error :: TimeOutError)我正在使用rubymine編輯器。
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until { @driver.find_element(:xpath => "//*[@id='j_id0:pb:j_id35']") }
@driver.find_element(:xpath => "//*[@id='j_id0:pb:j_id35']").send_keys "test send sms"
文本區域元素位於頁面底部。是否需要向下滾動頁面並單擊並在文本區域中發送密鑰。 在下面的代碼中,我試圖找到最接近文本框的元素並向下滾動,然后單擊文本區域和sendkeys。但是即使它不起作用..
#wait = Selenium::WebDriver::Wait.new(:timeout => 10)
#wait.until { @driver.find_element(:name => "j_id0:pb:j_id33") }
#scroll = @driver.find_element(:name => "j_id0:pb:j_id33")
#scroll.location_once_scrolled_into_view
請幫忙..謝謝!
我對魯迪一無所知,但可以在邏輯上幫助您。
1)首先將頁面從您的代碼滾動到文本區域。
2)通過id,xpath等選擇文本區域。driver.findelement(by.id(...))。sendkey(..........);
謝謝Shukla!@sourabh shukla我的礦井里面有框架,所以我需要切換到框架,這就是為什么我無法理解該元素的原因! @ driver.switch_to.frame(“ 06618000000Crrp”#這是id); 然后我的元素找到並輸入文本!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.