我现在所拥有的是:
chrome_options = Options()
chrome_options.add_extension(r"C:\Users\x\OneDrive\Desktop\pp\crxSolver.crx")
driver = webdriver.Chrome(r'C:\Users\x\OneDrive\Desktop\chromedriver.exe', options=chrome_options)
driver.get("https://www.google.com")
Run Code Online (Sandbox Code Playgroud)
我能够打开网络驱动程序,并且可以在Google Chrome浏览器的右上角看到添加的扩展程序,但是该驱动程序不会转到google.com。我已经搜索了很多,但找不到解决方案。
这是扩展名的链接:https : //chrome.google.com/webstore/detail/buster-captcha-solver-for/mpbjkejclgfgadiemmefgebjfooflfhl/related
我正在尝试在nike网络商店中结帐,但我已经尝试了所有方法并进行了搜索,但找不到答案。
https://www.nike.com/nl/nl/checkout/tunnel
我有:
driver.find_element_by_xpath('//button[@id="qa-guest-checkout-mobile"]').click()
<button id="qa-guest-checkout-mobile" aria-label="Guest Checkout"
class="ncss-btn-accent u-rounded u-full-width ncss-brand u-uppercase pt3-sm pt2-lg pr5-sm pb3-sm pb2-lg pl5-sm fs14-sm d-lg-h">
<span class="d-sm-ib va-sm-m mr1-sm">Afrekenen als bezoeker</span></button>
Run Code Online (Sandbox Code Playgroud)
我试过使用id,css等查找,但它不起作用。我在这里做错了什么?当我打印元素时,我只会得到1个元素,然后不会出现错误。
File "C:\Users\X\OneDrive\Desktop\SN\NA.py", line 23, in <module>
test = driver.find_element_by_xpath('//button[@id="qa-guest-checkout-mobile"]').click()
File "C:\Users\X\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\X\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\X\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\X\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable
(Session info: chrome=74.0.3729.131)
(Driver info: …Run Code Online (Sandbox Code Playgroud) 因此,我想拍照并显示在屏幕上。我可以按按钮并拍照,但屏幕上没有显示ImageView。我无法通过搜索找到解决方案onActivityresult。
我现在所拥有的:
public class MainActivity extends AppCompatActivity {
ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnCamera = findViewById(R.id.btnCamera);
imageView = findViewById(R.id.imageView);
// Open camera and take picture
btnCamera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 0);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode,Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bitmap bitmap = (Bitmap)data.getExtras().get("Data");
imageView.setImageBitmap(bitmap);
}
}
Run Code Online (Sandbox Code Playgroud)