这很有趣......我之前编写的混合应用程序在手机处于横向模式时不会崩溃。 我写了一个样本混合应用程序,它使用phonegap,cordova,HTML,Bootstrap,css,js向一名大三学生解释。我接受了link for explaining to my junior 我在HTML文件中做的唯一更改是:
from selenium import selenium
import unittest
class TestGoogle(unittest.TestCase):
def setUp(self):
self.selenium = selenium("localhost", \
4444, "*firefox", "http://www.google.com/webhp")
#self.selenium.set_timeout('60000')
self.selenium.start()
def test_google(self):
sel = self.selenium
sel.open("http://www.google.com/webhp")
#sel.wait_for_page_to_load(5000)
print sel.get_location()
sel.open(sel.get_location())
sel.type("q", "hello world")
sel.click("btnG")
#sel.wait_for_page_to_load(500000)
varc= sel.get_location()
print varc
sel.open(varc)
#sel.wait_for_page_to_load(50000)
self.assertEqual("hello world - Google Search", sel.get_title())
def tearDown(self):
self.selenium.stop()
if __name__ == "__main__":
unittest.main()`
它在纵向模式下完美运行,但在移动设备进入横向模式时崩溃。 androidmanifest.xml是否缺少方向偏好?我怎样才能解决这个问题?
<!DOCTYPE HTML>
<html>
<head>
<title>Bootstrap Form</title>
<link rel="stylesheet" type="text/css" href="support/bootstrap/css/bootstrap.min.css">
<script type="text/javascript" charset="utf-8" src="js/cordova-2.7.0.js"></script>
<script type="text/javascript" charset="utf-8" src="support/bootstrap/scripts/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="support/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<h1>Hello Form</h1>
<div class="container">
<div class="row">
<div class="col-sm-12">
<form role="form">
<div class="form-group">
<label for="email">Email address:</label>
<input type="email" class="form-control" id="email">
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd">
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Remember me</label>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
</div>
</div>
</body>
</html>
logcat: