webcontent

What's the meaning of page and page.body in Capybara

这一生的挚爱 提交于 2019-12-01 23:26:35
问题 I'm a newbie try to test my Rails project using Capybara, but I'm confused with the meaning of page and page.body, when I try to detect some string from my div: (in :js=>true mode) <div>"some content"</div> Some of my test will pass with page.should have_content "some content" Some will pass with page.body.should have_content "some content" I try to puts the content but only "page.body" will give me some valuable information, the "page" itself will show me nothing, and I can't find any solid

What's the meaning of page and page.body in Capybara

醉酒当歌 提交于 2019-12-01 22:02:30
I'm a newbie try to test my Rails project using Capybara, but I'm confused with the meaning of page and page.body, when I try to detect some string from my div: (in :js=>true mode) <div>"some content"</div> Some of my test will pass with page.should have_content "some content" Some will pass with page.body.should have_content "some content" I try to puts the content but only "page.body" will give me some valuable information, the "page" itself will show me nothing, and I can't find any solid explanation about what page and page.body did. Can anyone help me? page is the current Capybara session

How can I get real path for file in my WebContent folder?

落花浮王杯 提交于 2019-11-29 02:02:23
I need to get real path for file in my WebContent directory, so that framework that I use can access that file. It only takes String file as attribute, so I need to get the real path to this file in WebContent directory. I use Spring Framework, so solution should be possible to make in Spring. If you need this in a servlet then use getServletContext().getRealPath("/filepathInContext") ! getServletContext().getRealPath("") - This way will not work if content is being made available from a .war archive. getServletContext() will be null. In this case we can use another way to get real path. This

How can I get real path for file in my WebContent folder?

守給你的承諾、 提交于 2019-11-27 16:32:04
问题 I need to get real path for file in my WebContent directory, so that framework that I use can access that file. It only takes String file as attribute, so I need to get the real path to this file in WebContent directory. I use Spring Framework, so solution should be possible to make in Spring. 回答1: If you need this in a servlet then use getServletContext().getRealPath("/filepathInContext") ! 回答2: getServletContext().getRealPath("") - This way will not work if content is being made available