从嵌入在OCXState中的Flash SWF中提取(Extract Flash SWF from embedded in OCXState)
我有一个使用AxShockwaveFlash嵌入Flash SWF的表单。 我不再拥有原始的SWF文件,我想从AxShockwaveFlash对象中提取它。
我已经尝试将OCXState拉出并将其保存到磁盘(通过立即窗口),如下所示:
((System.IO.MemoryStream)axShockwaveFlash1.OcxState.ms) .WriteTo(System.IO.File.OpenWrite(@"C:\Users\Michael\Desktop\Test.swf"))
但该文件似乎不是有效的SWF。
如何提取嵌入的Flash文件并保存到SWF文件?
I have a form with an Flash SWF embedded using AxShockwaveFlash. I no longer have the original SWF file and I'd like to extract it from the AxShockwaveFlash object.
I've tried pulling the OCXState out and saving it to disk (via the Immediate Window) like this:
((System.IO.MemoryStream)axShockwaveFlash1.OcxState.ms) .WriteTo(System.IO.File.OpenWrite(@"C:\Users\Michael\Desktop\Test.swf"))
But the file doesn't appear to be a valid SWF.
How can I extract the embedded Flash file and save to a SWF file?
原文:https://stackoverflow.com/questions/18920484
最满意答案
您可以做的是先检查是否有弹出窗口
public boolean isAlertPresent() { try{ WebDriverWait wait = new WebDriverWait(driver, 5); wait.until(ExpectedConditions.alertIsPresent()); return true; } catch (NoAlertPresentException noAlert) { return false; } catch (TimeoutException timeOutEx){ return false; } }
如果它存在,那么你可以接受它
WebDriverWait wait = new WebDriverWait(driver, 10); Alert alert = wait.until(ExpectedConditions.alertIsPresent()); alert.accept();
要么
JavascriptExecutor为你工作。 在单击调用警报的事件之前,请务必执行它。
((JavascriptExecutor) driver).executeScript("window.confirm = function(msg) { return true; }");
注意: - 点击调用警报确认框的事件后不要使用它。 默认情况下,上面的代码将确认框设置为true表示如果调用,则表示您接受/单击该页面上所有确认框中的确定。 如果要关闭警报,请将标志更改为false
希望它能帮到你:)
It seems that Webdriver's Alert did not work for me because login request does not rise Javascript alert event. So there was nothing to detect or switch to.
Solved by this piece of code which simply sends ESCAPE key to the browser:
Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_ESCAPE); robot.keyRelease(KeyEvent.VK_ESCAPE);
Thanks everyone for help.
相关问答
更多-
您可以做的是先检查是否有弹出窗口 public boolean isAlertPresent() { try{ WebDriverWait wait = new WebDriverWait(driver, 5); wait.until(ExpectedConditions.alertIsPresent()); return true; } catch (NoAlertPresentException noAlert) { retu ...
-
登录后如何自动关闭SharePoint Online登录窗口?(How to auto close SharePoint Online sign in window after signing in?)[2022-11-10]
我认为,当用户单击“确定”并运行身份验证代码并对用户进行身份验证时,您可以运行代码或javascriupt来关闭窗口。 如果我错过了什么,请纠正我 I've found the solution. Create an .aspx page on SharePoint, place JavaScript to close the window (window.close) in it. Then from web application, if user not logged in SharePoint On ... -
WPF MVVM关闭窗口(WPF MVVM Close Window)[2023-12-05]
我建议您明确关闭要关闭的窗口,而不是假设它是当前的主窗口。 使用MVVM有很多不同的方法,你可以使用附加行为或通过命令参数将窗口传递给视图模型,如下所示: 在按钮xaml中查看: CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" 在视图模型中的命令execute方法中: if (parameter is System.Windows.Window) { Win ... -
你可以用各种方式做到这一点。 在不改变太多的情况下,可以在frmLogin中添加一个布尔属性,例如 public bool CloseMainForm { get; private set; } 默认值应为true,当您不需要关闭主窗口时,可以将其设置为False,例如 ... main.BringIntoView(); this.CloseMainForm = false; this.Close(); ... 并更改您的事件处理程序 login.Closed += (s, args) => { if ...
-
假设你已经包含了jquery。 在顶端 declare $ :any; onSignInSubmit(){ $('#exampleModal').modal('hide'); .... 我希望这有帮助。 随意发表评论。 Assuming you have already included jquery. on the top declare $ :any; onSignInSubmit(){ $('#exampleModal').modal('hide'); .... I ...
-
如何从按钮关闭窗口(How to close window from button)[2022-05-05]
我发现上述两个问题: 窗口的名称是错误的。 我需要设置按钮类型=“按钮” 然后它奏效了。 格雷格 I found two issues with the above: The name of the window was wrong. I needed to set the button type="button" Then it worked. Greg -
我认为这是与此帖相同的问题: Facebook Connect对话框没有关闭 I think it's the same question of this post: Facebook Connect Dialog Box doesn't close
-
父窗口中的登录窗口(Login window within the parent window)[2023-07-08]
您可以使用jQuery Dialog创建登录对话框,在其中您要求用户提供其凭据。 但是可以用javascript创建它。 看一下jQuery UI https://jqueryui.com/dialog/#modal-confirmation You can use jQuery Dialog to create a login dialog in where you ask the user for his credentials. But yes it can be created with javas ... -
要从iframe中关闭fancybox,您可以使用parent.$.fancybox.close(); 在form submit()事件。 然后在Fancybox初始化程序中添加一个onClose事件,该事件将重新加载页面: $(".login-popup").fancybox({ maxWidth : 310, height : 300, autoSize : false, closeClick : false, openEffect : ...
-
在活动的清单文件中添加此项 android:configChanges="keyboardHidden|screenSize|orientation" Add this in manifest file for your Activity android:configChanges="keyboardHidden|screenSize|orientation"