このようになり画像が表示できません。
どのようにすれば画像を表示できますでしょうか?
Controller
1def index 2require 'selenium-webdriver' 3require 'nokogiri' 4 5options = Selenium::WebDriver::Chrome::Options.new 6options.add_argument('--headless') 7options.add_argument('--disable-gpu') 8 9driver = Selenium::WebDriver.for :chrome, options: options 10 11@title = params[:title] 12 13driver.navigate.to 'https://www.justwatch.com/jp/検索?q='+ @title 14wait = Selenium::WebDriver::Wait.new(timeout: 300) 15wait.until { driver.find_element(xpath: '//div[2]/filter-bar/div[2]/div[2]/div[3]/div[2]/div') } 16 17el = driver.find_elements(:xpath, '/html/body/div[2]/filter-bar/ng-transclude/core-list/div/div/div[1]/search-result-entry/div/div[1]/div/div/title-card/track-title-control/div/div[1]/div/div/a/img[2]') 18 19doc = Nokogiri::HTML.parse(driver.execute_script('return document.documentElement.innerHTML')) 20 21# 検索結果のタイトルを表示 22doc.xpath('/html/body/div[2]/filter-bar/ng-transclude/core-list/div/div/div[1]').each do |node| 23 @result= "結果:" + node.xpath('/html/body/div[2]/filter-bar/ng-transclude/core-list/div/div/div[1]/search-result-entry/div/div[2]/div[2]/div/div[1]/div/div/div/div/div[2]/div[1]', 24 '/html/body/div[2]/filter-bar/ng-transclude/core-list/div/div/div[1]/search-result-entry/div/div[2]/div[1]/a').text 25 @links = el.map{|a| a.attribute('src')} 26end 27driver.quit 28 end
View
1<h1>Titles</h1> 2 3<%= form_tag({action: :index}, {method: :get}) do %> 4 <%= label_tag :title, 'タイトル' %> 5 <%= text_field_tag :title, @title %> 6 7 <%= submit_tag '検索' %> 8<% end %> 9 10<%= @links %> 11<%= @result %>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。